Commit a1bcfa9a authored by James Cook's avatar James Cook Committed by Commit Bot

cros: Make both --mus and --mash available in about:flags

* Allow --mus on all channels (canary, dev, beta, stable).
* Allow --mash on everything but stable.
* Ensure only one copy of the --mus flag if the user specifies
  both --mus and --mash. The build will run in --mash mode.

Bug: none
Test: about:flags has both options separately
Change-Id: Ic111189e288a8784718f4df0a99bae865734fe6f
Reviewed-on: https://chromium-review.googlesource.com/891624Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532686}
parent 320a2078
...@@ -49,6 +49,39 @@ int ChromeMain(int argc, const char** argv); ...@@ -49,6 +49,39 @@ int ChromeMain(int argc, const char** argv);
} }
#endif #endif
namespace {
#if BUILDFLAG(ENABLE_MUS)
void ConfigureMus(content::ContentMainParams* params) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
#if defined(OS_CHROMEOS)
// --mash implies --mus, so check it first.
if (command_line->HasSwitch(switches::kMash)) {
params->create_discardable_memory = false;
params->env_mode = aura::Env::Mode::MUS;
// Don't add --mus if the user had both --mash and --mus.
if (!command_line->HasSwitch(switches::kMus))
command_line->AppendSwitch(switches::kMus);
command_line->AppendSwitch(switches::kMusHostingViz);
return;
}
#endif // defined(OS_CHROMEOS)
// In config==mus the ui service runs in process and is shut down well before
// the rest of Chrome. Have Chrome create the DiscardableSharedMemoryManager
// to ensure the DiscardableSharedMemoryManager is destroyed later on. Doing
// this avoids lifetime issues when internal implementation details of
// DiscardableSharedMemoryManager assume DiscardableSharedMemoryManager is
// long lived.
if (command_line->HasSwitch(switches::kMus)) {
params->create_discardable_memory = true;
params->env_mode = aura::Env::Mode::MUS;
}
}
#endif // BUILDFLAG(ENABLE_MUS)
} // namespace
#if defined(OS_WIN) #if defined(OS_WIN)
DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance,
sandbox::SandboxInterfaceInfo* sandbox_info, sandbox::SandboxInterfaceInfo* sandbox_info,
...@@ -105,26 +138,8 @@ int ChromeMain(int argc, const char** argv) { ...@@ -105,26 +138,8 @@ int ChromeMain(int argc, const char** argv) {
#endif // defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) #endif // defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN)
#if BUILDFLAG(ENABLE_MUS) #if BUILDFLAG(ENABLE_MUS)
// In config==mus the ui service runs in process and is shut down well before ConfigureMus(&params);
// the rest of Chrome. Have Chrome create the DiscardableSharedMemoryManager #endif
// to ensure the DiscardableSharedMemoryManager is destroyed later on. Doing
// this avoids lifetime issues when internal implementation details of
// DiscardableSharedMemoryManager assume DiscardableSharedMemoryManager is
// long lived.
if (command_line->HasSwitch(switches::kMus)) {
params.create_discardable_memory = true;
params.env_mode = aura::Env::Mode::MUS;
}
#if defined(OS_CHROMEOS)
if (command_line->HasSwitch(switches::kMash)) {
params.create_discardable_memory = false;
params.env_mode = aura::Env::Mode::MUS;
base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kMus);
base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kMusHostingViz);
}
#endif // defined(OS_CHROMEOS)
#endif // BUILDFLAG(ENABLE_MUS)
int rv = content::ContentMain(params); int rv = content::ContentMain(params);
......
...@@ -512,12 +512,6 @@ const FeatureEntry::Choice kDataSaverPromptChoices[] = { ...@@ -512,12 +512,6 @@ const FeatureEntry::Choice kDataSaverPromptChoices[] = {
chromeos::switches::kDataSaverPromptDemoMode}, chromeos::switches::kDataSaverPromptDemoMode},
}; };
const FeatureEntry::Choice kUseMusChoices[] = {
{flags_ui::kGenericExperimentChoiceDefault, "", ""},
{flag_descriptions::kEnableMusDescription, switches::kMus, ""},
{flag_descriptions::kEnableMashDescription, switches::kMash, ""},
};
const FeatureEntry::Choice kUiShowCompositedLayerBordersChoices[] = { const FeatureEntry::Choice kUiShowCompositedLayerBordersChoices[] = {
{flags_ui::kGenericExperimentChoiceDefault, "", ""}, {flags_ui::kGenericExperimentChoiceDefault, "", ""},
{flag_descriptions::kUiShowCompositedLayerBordersRenderPass, {flag_descriptions::kUiShowCompositedLayerBordersRenderPass,
...@@ -1523,7 +1517,10 @@ const FeatureEntry kFeatureEntries[] = { ...@@ -1523,7 +1517,10 @@ const FeatureEntry kFeatureEntries[] = {
FEATURE_VALUE_TYPE(features::kMultidevice)}, FEATURE_VALUE_TYPE(features::kMultidevice)},
{"mus", flag_descriptions::kUseMusName, {"mus", flag_descriptions::kUseMusName,
flag_descriptions::kUseMusDescription, kOsCrOS, flag_descriptions::kUseMusDescription, kOsCrOS,
MULTI_VALUE_TYPE(kUseMusChoices)}, SINGLE_VALUE_TYPE(switches::kMus)},
{"mash", flag_descriptions::kUseMashName,
flag_descriptions::kUseMashDescription, kOsCrOS,
SINGLE_VALUE_TYPE(switches::kMash)},
{"show-taps", flag_descriptions::kShowTapsName, {"show-taps", flag_descriptions::kShowTapsName,
flag_descriptions::kShowTapsDescription, kOsCrOS, flag_descriptions::kShowTapsDescription, kOsCrOS,
SINGLE_VALUE_TYPE(ash::switches::kShowTaps)}, SINGLE_VALUE_TYPE(ash::switches::kShowTaps)},
...@@ -3718,11 +3715,9 @@ class FlagsStateSingleton { ...@@ -3718,11 +3715,9 @@ class FlagsStateSingleton {
bool SkipConditionalFeatureEntry(const FeatureEntry& entry) { bool SkipConditionalFeatureEntry(const FeatureEntry& entry) {
version_info::Channel channel = chrome::GetChannel(); version_info::Channel channel = chrome::GetChannel();
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// Only expose --mash/--mus on unstable channels and developer builds. // Don't expose --mash on stable channel.
if (!strcmp("mus", entry.internal_name) && if (!strcmp("mash", entry.internal_name) &&
channel != version_info::Channel::DEV && channel == version_info::Channel::STABLE) {
channel != version_info::Channel::CANARY &&
channel != version_info::Channel::UNKNOWN) {
return true; return true;
} }
......
...@@ -2748,12 +2748,15 @@ const char kUiDevToolsDescription[] = ...@@ -2748,12 +2748,15 @@ const char kUiDevToolsDescription[] =
"Enables inspection of native UI elements. For local inspection use " "Enables inspection of native UI elements. For local inspection use "
"chrome://inspect#other"; "chrome://inspect#other";
const char kUseMusName[] = "Mus"; const char kUseMusName[] = "Mojo UI service (mus)";
const char kUseMusDescription[] = "Enable the Mojo UI service."; const char kUseMusDescription[] =
const char kEnableMashDescription[] = "Handles input events, display configuration, and windowing in a mojo "
"Mash (UI, Chrome and ash in separate services)"; "service on a thread in the browser process.";
const char kEnableMusDescription[] =
"Mus (UI in separate service, Chrome and ash in same service)"; const char kUseMashName[] = "Out-of-process system UI (mash)";
const char kUseMashDescription[] =
"Runs the mojo UI service (mus) and the ash window manager and system UI "
"in a separate process.";
// TODO(mcasas): remove after https://crbug.com/771345. // TODO(mcasas): remove after https://crbug.com/771345.
const char kUseMonitorColorSpaceName[] = "Use monitor color space"; const char kUseMonitorColorSpaceName[] = "Use monitor color space";
......
...@@ -1684,8 +1684,9 @@ extern const char kUiDevToolsDescription[]; ...@@ -1684,8 +1684,9 @@ extern const char kUiDevToolsDescription[];
extern const char kUseMusName[]; extern const char kUseMusName[];
extern const char kUseMusDescription[]; extern const char kUseMusDescription[];
extern const char kEnableMashDescription[];
extern const char kEnableMusDescription[]; extern const char kUseMashName[];
extern const char kUseMashDescription[];
extern const char kUseMonitorColorSpaceName[]; extern const char kUseMonitorColorSpaceName[];
extern const char kUseMonitorColorSpaceDescription[]; extern const char kUseMonitorColorSpaceDescription[];
......
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