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 "mojo/runner/desktop/main_helper.h" |
| 6 |
| 7 |
5 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/base_switches.h" |
6 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/debug/debugger.h" |
7 #include "base/debug/stack_trace.h" | 12 #include "base/debug/stack_trace.h" |
| 13 #include "base/files/file_path.h" |
| 14 #include "base/logging.h" |
8 #include "base/process/launch.h" | 15 #include "base/process/launch.h" |
9 #include "mandoline/app/desktop/launcher_process.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/strings/string_split.h" |
| 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "mojo/runner/desktop/launcher_process.h" |
10 #include "mojo/runner/host/child_process.h" | 20 #include "mojo/runner/host/child_process.h" |
11 #include "mojo/runner/host/switches.h" | 21 #include "mojo/runner/host/switches.h" |
12 #include "mojo/runner/init.h" | 22 #include "mojo/runner/init.h" |
13 | 23 |
14 int main(int argc, char** argv) { | 24 #if defined(OS_WIN) |
| 25 #include <windows.h> |
| 26 #elif (OS_POSIX) |
| 27 #include <unistd.h> |
| 28 #endif |
| 29 |
| 30 namespace mojo { |
| 31 namespace runner { |
| 32 |
| 33 int RunnerMain(int argc, char** argv, |
| 34 const GURL& mojo_url, |
| 35 const base::Closure& callback) { |
15 base::CommandLine::Init(argc, argv); | 36 base::CommandLine::Init(argc, argv); |
16 const base::CommandLine& command_line = | 37 const base::CommandLine& command_line = |
17 *base::CommandLine::ForCurrentProcess(); | 38 *base::CommandLine::ForCurrentProcess(); |
18 | 39 |
19 base::AtExitManager at_exit; | 40 base::AtExitManager at_exit; |
20 mojo::runner::InitializeLogging(); | 41 InitializeLogging(); |
21 mojo::runner::WaitForDebuggerIfNecessary(); | 42 WaitForDebuggerIfNecessary(); |
22 | 43 |
23 #if !defined(OFFICIAL_BUILD) | 44 #if !defined(OFFICIAL_BUILD) |
24 base::debug::EnableInProcessStackDumping(); | 45 base::debug::EnableInProcessStackDumping(); |
25 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
26 base::RouteStdioToConsole(false); | 47 base::RouteStdioToConsole(false); |
27 #endif | 48 #endif |
28 #endif | 49 #endif |
29 | 50 |
30 if (command_line.HasSwitch(switches::kChildProcess)) | 51 if (command_line.HasSwitch(switches::kChildProcess)) |
31 return mojo::runner::ChildProcessMain(); | 52 return ChildProcessMain(); |
32 | 53 |
33 return mandoline::LauncherProcessMain(argc, argv); | 54 return LauncherProcessMain(mojo_url, callback); |
34 } | 55 } |
| 56 |
| 57 } // namespace runner |
| 58 } // namespace mojo |
OLD | NEW |