Remove //base dependency from libcast_graphics_1.0
This .so is loaded into other processes that already have //base; having two copies of //base seems to be a recipe for trouble, especially with PartitionAlloc: which module "wins" seems inconsistent. Luckily, the switch parsing here is pretty straightforward, so just hardcode the strings to look for in `argv`. Bug: 404881580 Change-Id: If35d206c6a8d1c35c1c5578f5d4d00fef49388a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6504932 Commit-Queue: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Shawn Quereshi <shawnq@google.com> Cr-Commit-Position: refs/heads/main@{#1455195}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
6cfcb9841e
commit
ad5cbdeff8
chromecast/graphics
@@ -122,11 +122,10 @@ cast_shared_library("libcast_graphics_1.0") {
|
|||||||
|
|
||||||
public_deps = [ "//chromecast/public" ]
|
public_deps = [ "//chromecast/public" ]
|
||||||
|
|
||||||
deps = [
|
deps = [ "//base:base_static" ]
|
||||||
"//base",
|
|
||||||
"//chromecast/base:chromecast_switches",
|
# Note: this target must not transitively depend on //base, as having two
|
||||||
"//chromecast/base:init_shlib",
|
# copies of //base in the same address space leads to hard-to-debug crashes.
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_aura && !is_cast_audio_only && !is_fuchsia) {
|
if (use_aura && !is_cast_audio_only && !is_fuchsia) {
|
||||||
|
@@ -2,10 +2,11 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include <algorithm>
|
||||||
#include "base/notreached.h"
|
#include <string>
|
||||||
#include "chromecast/base/chromecast_switches.h"
|
#include <vector>
|
||||||
#include "chromecast/base/init_command_line_shlib.h"
|
|
||||||
|
#include "base/immediate_crash.h"
|
||||||
#include "chromecast/public/graphics_properties_shlib.h"
|
#include "chromecast/public/graphics_properties_shlib.h"
|
||||||
|
|
||||||
namespace chromecast {
|
namespace chromecast {
|
||||||
@@ -13,15 +14,18 @@ namespace chromecast {
|
|||||||
bool GraphicsPropertiesShlib::IsSupported(
|
bool GraphicsPropertiesShlib::IsSupported(
|
||||||
Resolution resolution,
|
Resolution resolution,
|
||||||
const std::vector<std::string>& argv) {
|
const std::vector<std::string>& argv) {
|
||||||
InitCommandLineShlib(argv);
|
|
||||||
switch (resolution) {
|
switch (resolution) {
|
||||||
case Resolution::k1080p:
|
case Resolution::k1080p:
|
||||||
return base::CommandLine::ForCurrentProcess()->HasSwitch(
|
return std::ranges::any_of(argv, [](const std::string& arg) {
|
||||||
switches::kDesktopWindow1080p);
|
// This is defined by `kDesktopWindow1080p`, but it can't be used here
|
||||||
|
// since //chromecast/base depends on //base.
|
||||||
|
return arg == "-desktop-window-1080p" ||
|
||||||
|
arg == "--desktop-window-1080p";
|
||||||
|
});
|
||||||
case Resolution::kUHDTV:
|
case Resolution::kUHDTV:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
NOTREACHED();
|
base::ImmediateCrash();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user