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 "services/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 "services/shell/runner/common/switches.h" | |
12 #include "services/shell/runner/host/child_process.h" | |
13 #include "services/shell/runner/init.h" | |
14 | |
15 namespace shell { | |
16 namespace { | |
17 | |
18 int RunChildProcess() { | |
19 base::AtExitManager at_exit; | |
20 InitializeLogging(); | |
21 WaitForDebuggerIfNecessary(); | |
22 #if !defined(OFFICIAL_BUILD) && defined(OS_WIN) | |
23 base::RouteStdioToConsole(false); | |
24 #endif | |
25 return ChildProcessMain(); | |
26 } | |
27 | |
28 } // namespace | |
29 } // namespace shell | |
30 | |
31 int main(int argc, char** argv) { | |
32 base::CommandLine::Init(argc, argv); | |
33 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
34 switches::kChildProcess)) { | |
35 return shell::RunChildProcess(); | |
36 } | |
37 // Reset CommandLine as most likely main() is going to use CommandLine too | |
38 // and expect to be able to initialize it. | |
39 base::CommandLine::Reset(); | |
40 return MasterProcessMain(argc, argv); | |
41 } | |
OLD | NEW |