| 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" | |
| 25 | 24 |
| 26 namespace mojo { | 25 namespace mojo { |
| 27 namespace runner { | 26 namespace runner { |
| 28 | 27 |
| 29 int LauncherProcessMain(int argc, char** argv) { | 28 int LauncherProcessMain(int argc, char** argv) { |
| 30 mojo::runner::Tracer tracer; | 29 mojo::runner::Tracer tracer; |
| 31 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 30 const base::CommandLine& command_line = |
| 32 if (!command_line->HasSwitch(switches::kMojoSingleProcess) && | 31 *base::CommandLine::ForCurrentProcess(); |
| 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); | |
| 38 | 32 |
| 39 bool trace_startup = command_line->HasSwitch(switches::kTraceStartup); | 33 bool trace_startup = command_line.HasSwitch(switches::kTraceStartup); |
| 40 if (trace_startup) { | 34 if (trace_startup) { |
| 41 tracer.Start( | 35 tracer.Start( |
| 42 command_line->GetSwitchValueASCII(switches::kTraceStartup), | 36 command_line.GetSwitchValueASCII(switches::kTraceStartup), |
| 43 command_line->GetSwitchValueASCII(switches::kTraceStartupDuration), | 37 command_line.GetSwitchValueASCII(switches::kTraceStartupDuration), |
| 44 "mandoline.trace"); | 38 "mandoline.trace"); |
| 45 } | 39 } |
| 46 | 40 |
| 47 // We want the shell::Context to outlive the MessageLoop so that pipes are | 41 // We want the shell::Context to outlive the MessageLoop so that pipes are |
| 48 // all gracefully closed / error-out before we try to shut the Context down. | 42 // all gracefully closed / error-out before we try to shut the Context down. |
| 49 base::FilePath shell_dir; | 43 base::FilePath shell_dir; |
| 50 PathService::Get(base::DIR_MODULE, &shell_dir); | 44 PathService::Get(base::DIR_MODULE, &shell_dir); |
| 51 Context shell_context(shell_dir, &tracer); | 45 Context shell_context(shell_dir, &tracer); |
| 52 { | 46 { |
| 53 base::MessageLoop message_loop; | 47 base::MessageLoop message_loop; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 64 | 58 |
| 65 // Must be called before |message_loop| is destroyed. | 59 // Must be called before |message_loop| is destroyed. |
| 66 shell_context.Shutdown(); | 60 shell_context.Shutdown(); |
| 67 } | 61 } |
| 68 | 62 |
| 69 return 0; | 63 return 0; |
| 70 } | 64 } |
| 71 | 65 |
| 72 } // namespace runner | 66 } // namespace runner |
| 73 } // namespace mojo | 67 } // namespace mojo |
| OLD | NEW |