Commit 4f442609 authored by Wez's avatar Wez Committed by Commit Bot

[fuchsia] Update allowed config command-line arguments.

Temporarily relax the implementation to tolerate the presence of
unrecognized command-line parameters in the config file.

Allow some additional command-line options to be passed through:
  --enable-features
  --enable-low-end-device-mode
  --force-gpu-mem-available-mb

Bug: 1020358, 1023012, 1020698, 1032439
Change-Id: I68799a8e1f6f1ef96df29b22e73efc9df11868db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1954540
Commit-Queue: Wez <wez@chromium.org>
Auto-Submit: Wez <wez@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723280}
parent fdea7251
......@@ -149,6 +149,9 @@ bool MaybeAddCommandLineArgsFromConfig(const base::Value& config,
return true;
static const base::StringPiece kAllowedArgs[] = {
switches::kEnableFeatures,
switches::kEnableLowEndDeviceMode,
switches::kForceGpuMemAvailableMb,
switches::kRendererProcessLimit,
switches::kMinHeightForGpuRasterTile,
};
......@@ -156,13 +159,22 @@ bool MaybeAddCommandLineArgsFromConfig(const base::Value& config,
for (const auto& arg : args->DictItems()) {
if (!base::Contains(kAllowedArgs, arg.first)) {
LOG(ERROR) << "Unknown command-line arg: " << arg.first;
return false;
// TODO(https://crbug.com/1032439): Return false here once we are done
// experimenting with memory-related command-line options.
continue;
}
if (!arg.second.is_string()) {
LOG(ERROR) << "Config command-line arg must be a string: " << arg.first;
return false;
}
command_line->AppendSwitchNative(arg.first, arg.second.GetString());
// TODO(https://crbug.com/1023012): enable-low-end-device-mode currently
// fakes 512MB total physical memory, which triggers RGB4444 textures,
// which
// we don't yet support.
if (arg.first == switches::kEnableLowEndDeviceMode)
command_line->AppendSwitch(switches::kDisableRGBA4444Textures);
}
return true;
......
......@@ -408,16 +408,17 @@ TEST(ContextProviderImplConfigTest, WithConfigWithDisallowedCommandLineArgs) {
ContextProviderImpl context_provider;
context_provider.set_config_for_test(std::move(config_dict));
context_provider.SetLaunchCallbackForTest(
base::BindLambdaForTesting([&](const base::CommandLine& command,
const base::LaunchOptions& options) {
ADD_FAILURE();
base::BindLambdaForTesting([&loop](const base::CommandLine& command,
const base::LaunchOptions& options) {
EXPECT_FALSE(command.HasSwitch("kittens-are-nice"));
loop.Quit();
return base::Process();
}));
fuchsia::web::ContextPtr context;
context.set_error_handler([&loop](zx_status_t status) {
EXPECT_EQ(status, ZX_ERR_INTERNAL);
ZX_LOG(ERROR, status);
ADD_FAILURE();
loop.Quit();
});
context_provider.Create(BuildCreateContextParams(), context.NewRequest());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment