Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(600)

Unified Diff: shell/desktop/mojo_main.cc

Issue 973203004: Make the shell work in multiprocess mode some apps. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: better (?) comment Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « shell/context.h ('k') | shell/switches.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/desktop/mojo_main.cc
diff --git a/shell/desktop/mojo_main.cc b/shell/desktop/mojo_main.cc
index a5033b430effb874ec7edd8b64734b30dd8f1935..b5d7e62aed90926d67dc632952fa791553027c21 100644
--- a/shell/desktop/mojo_main.cc
+++ b/shell/desktop/mojo_main.cc
@@ -51,34 +51,6 @@ int main(int argc, char** argv) {
base::AtExitManager at_exit;
base::CommandLine::Init(argc, argv);
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
-
- const std::set<std::string> all_switches = switches::GetAllSwitches();
- const base::CommandLine::SwitchMap switches = command_line.GetSwitches();
- bool found_unknown_switch = false;
- for (const auto& s : switches) {
- if (all_switches.find(s.first) == all_switches.end()) {
- std::cerr << "unknown switch: " << s.first << std::endl;
- found_unknown_switch = true;
- }
- }
-
- if (found_unknown_switch ||
- (!command_line.HasSwitch(switches::kEnableExternalApplications) &&
- (command_line.HasSwitch(switches::kHelp) ||
- command_line.GetArgs().empty()))) {
- Usage();
- return 0;
- }
-
-#if defined(OS_LINUX)
- // We use gfx::RenderText from multiple threads concurrently and the pango
- // backend (currently the default on linux) is not close to threadsafe. Force
- // use of the harfbuzz backend for now.
- base::CommandLine::ForCurrentProcess()->AppendSwitch(
- kEnableHarfBuzzRenderText);
-#endif
mojo::shell::InitializeLogging();
// TODO(vtl): Unify parent and child process cases to the extent possible.
@@ -87,6 +59,36 @@ int main(int argc, char** argv) {
*base::CommandLine::ForCurrentProcess())) {
child_process->Main();
} else {
+ // Only check the command line for the main process.
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+
+ const std::set<std::string> all_switches = switches::GetAllSwitches();
+ const base::CommandLine::SwitchMap switches = command_line.GetSwitches();
+ bool found_unknown_switch = false;
+ for (const auto& s : switches) {
+ if (all_switches.find(s.first) == all_switches.end()) {
+ std::cerr << "unknown switch: " << s.first << std::endl;
+ found_unknown_switch = true;
+ }
+ }
+
+ if (found_unknown_switch ||
+ (!command_line.HasSwitch(switches::kEnableExternalApplications) &&
+ (command_line.HasSwitch(switches::kHelp) ||
+ command_line.GetArgs().empty()))) {
+ Usage();
+ return 0;
+ }
+
+#if defined(OS_LINUX)
+ // We use gfx::RenderText from multiple threads concurrently and the pango
+ // backend (currently the default on linux) is not close to threadsafe.
+ // Force use of the harfbuzz backend for now.
+ base::CommandLine::ForCurrentProcess()->AppendSwitch(
+ kEnableHarfBuzzRenderText);
+#endif
+
// We want the shell::Context to outlive the MessageLoop so that pipes are
// all gracefully closed / error-out before we try to shut the Context down.
mojo::shell::Context shell_context;
« no previous file with comments | « shell/context.h ('k') | shell/switches.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698