OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "mojo/shell/background/background_shell_main.h" |
| 6 |
| 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" |
| 9 #include "base/debug/debugger.h" |
| 10 #include "base/process/launch.h" |
| 11 #include "mojo/shell/runner/common/switches.h" |
| 12 #include "mojo/shell/runner/host/child_process.h" |
| 13 #include "mojo/shell/runner/init.h" |
| 14 |
| 15 namespace mojo { |
| 16 namespace shell { |
| 17 namespace { |
| 18 |
| 19 int RunChildProcess() { |
| 20 base::AtExitManager at_exit; |
| 21 InitializeLogging(); |
| 22 WaitForDebuggerIfNecessary(); |
| 23 #if !defined(OFFICIAL_BUILD) && defined(OS_WIN) |
| 24 base::RouteStdioToConsole(false); |
| 25 #endif |
| 26 return ChildProcessMain(); |
| 27 } |
| 28 |
| 29 } // namespace |
| 30 } // shell |
| 31 } // mojo |
| 32 |
| 33 int main(int argc, char** argv) { |
| 34 base::CommandLine::Init(argc, argv); |
| 35 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 36 switches::kChildProcess)) { |
| 37 return mojo::shell::RunChildProcess(); |
| 38 } |
| 39 // Reset CommandLine as most likely main() is going to use CommandLine too |
| 40 // and expect to be able to initialize it. |
| 41 base::CommandLine::Reset(); |
| 42 return MasterProcessMain(argc, argv); |
| 43 } |
OLD | NEW |