| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/service_manager/standalone/desktop/main_helper.h" | 5 #include "services/service_manager/standalone/desktop/main_helper.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/debugger.h" | 10 #include "base/debug/debugger.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/process/launch.h" | 13 #include "base/process/launch.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "services/service_manager/runner/common/switches.h" | 17 #include "services/service_manager/runner/common/switches.h" |
| 18 #include "services/service_manager/runner/host/child_process.h" |
| 18 #include "services/service_manager/runner/init.h" | 19 #include "services/service_manager/runner/init.h" |
| 19 #include "services/service_manager/standalone/desktop/launcher_process.h" | 20 #include "services/service_manager/standalone/desktop/launcher_process.h" |
| 20 | 21 |
| 21 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 22 #include <windows.h> | 23 #include <windows.h> |
| 23 #elif (OS_POSIX) | 24 #elif (OS_POSIX) |
| 24 #include <unistd.h> | 25 #include <unistd.h> |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 namespace service_manager { | 28 namespace service_manager { |
| 28 | 29 |
| 29 int StandaloneServiceManagerMain(int argc, char** argv) { | 30 int StandaloneServiceManagerMain(int argc, char** argv) { |
| 30 base::CommandLine::Init(argc, argv); | 31 base::CommandLine::Init(argc, argv); |
| 32 const base::CommandLine& command_line = |
| 33 *base::CommandLine::ForCurrentProcess(); |
| 31 | 34 |
| 32 base::AtExitManager at_exit; | 35 base::AtExitManager at_exit; |
| 33 InitializeLogging(); | 36 InitializeLogging(); |
| 34 WaitForDebuggerIfNecessary(); | 37 WaitForDebuggerIfNecessary(); |
| 35 | 38 |
| 36 #if !defined(OFFICIAL_BUILD) && defined(OS_WIN) | 39 #if !defined(OFFICIAL_BUILD) && defined(OS_WIN) |
| 37 base::RouteStdioToConsole(false); | 40 base::RouteStdioToConsole(false); |
| 38 #endif | 41 #endif |
| 39 | 42 |
| 43 if (command_line.HasSwitch(switches::kChildProcess)) |
| 44 return ChildProcessMain(); |
| 45 |
| 40 return LauncherProcessMain(); | 46 return LauncherProcessMain(); |
| 41 } | 47 } |
| 42 | 48 |
| 43 } // namespace service_manager | 49 } // namespace service_manager |
| OLD | NEW |