OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdio.h> | 5 #include <stdio.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iostream> | 9 #include <iostream> |
10 | 10 |
11 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
18 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
19 #include "components/tracing/trace_config_file.h" | 19 #include "components/tracing/trace_config_file.h" |
20 #include "components/tracing/tracing_switches.h" | 20 #include "components/tracing/tracing_switches.h" |
21 #include "mojo/runner/context.h" | 21 #include "mojo/runner/context.h" |
22 #include "mojo/runner/switches.h" | 22 #include "mojo/runner/switches.h" |
23 #include "mojo/runner/tracer.h" | 23 #include "mojo/runner/tracer.h" |
| 24 #include "mojo/shell/switches.h" |
24 | 25 |
25 namespace mojo { | 26 namespace mojo { |
26 namespace runner { | 27 namespace runner { |
27 | 28 |
28 int LauncherProcessMain(int argc, char** argv) { | 29 int LauncherProcessMain(int argc, char** argv) { |
29 mojo::runner::Tracer tracer; | 30 mojo::runner::Tracer tracer; |
30 const base::CommandLine& command_line = | 31 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
31 *base::CommandLine::ForCurrentProcess(); | 32 if (!command_line->HasSwitch(switches::kMojoSingleProcess) && |
| 33 !command_line->HasSwitch("gtest_list_tests")) |
| 34 command_line->AppendSwitch(switches::kEnableMultiprocess); |
| 35 command_line->AppendSwitch("use-new-edk"); |
| 36 // http://crbug.com/546644 |
| 37 command_line->AppendSwitch(switches::kMojoNoSandbox); |
32 | 38 |
33 bool trace_startup = command_line.HasSwitch(switches::kTraceStartup); | 39 bool trace_startup = command_line->HasSwitch(switches::kTraceStartup); |
34 if (trace_startup) { | 40 if (trace_startup) { |
35 tracer.Start( | 41 tracer.Start( |
36 command_line.GetSwitchValueASCII(switches::kTraceStartup), | 42 command_line->GetSwitchValueASCII(switches::kTraceStartup), |
37 command_line.GetSwitchValueASCII(switches::kTraceStartupDuration), | 43 command_line->GetSwitchValueASCII(switches::kTraceStartupDuration), |
38 "mandoline.trace"); | 44 "mandoline.trace"); |
39 } | 45 } |
40 | 46 |
41 // We want the shell::Context to outlive the MessageLoop so that pipes are | 47 // We want the shell::Context to outlive the MessageLoop so that pipes are |
42 // all gracefully closed / error-out before we try to shut the Context down. | 48 // all gracefully closed / error-out before we try to shut the Context down. |
43 base::FilePath shell_dir; | 49 base::FilePath shell_dir; |
44 PathService::Get(base::DIR_MODULE, &shell_dir); | 50 PathService::Get(base::DIR_MODULE, &shell_dir); |
45 Context shell_context(shell_dir, &tracer); | 51 Context shell_context(shell_dir, &tracer); |
46 { | 52 { |
47 base::MessageLoop message_loop; | 53 base::MessageLoop message_loop; |
(...skipping 10 matching lines...) Expand all Loading... |
58 | 64 |
59 // Must be called before |message_loop| is destroyed. | 65 // Must be called before |message_loop| is destroyed. |
60 shell_context.Shutdown(); | 66 shell_context.Shutdown(); |
61 } | 67 } |
62 | 68 |
63 return 0; | 69 return 0; |
64 } | 70 } |
65 | 71 |
66 } // namespace runner | 72 } // namespace runner |
67 } // namespace mojo | 73 } // namespace mojo |
OLD | NEW |