OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/system_monitor/system_monitor.h" | |
15 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
16 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/logging_chrome.h" | 16 #include "chrome/common/logging_chrome.h" |
18 #include "chrome/common/sandbox_policy.h" | 17 #include "chrome/common/sandbox_policy.h" |
19 #include "chrome/nacl/nacl_launcher_thread.h" | 18 #include "chrome/nacl/nacl_launcher_thread.h" |
20 #include "chrome/nacl/nacl_main_platform_delegate.h" | 19 #include "chrome/nacl/nacl_main_platform_delegate.h" |
21 #include "content/common/child_process.h" | 20 #include "content/common/child_process.h" |
22 #include "content/common/hi_res_timer_manager.h" | 21 #include "content/common/hi_res_timer_manager.h" |
23 #include "content/common/main_function_params.h" | 22 #include "content/common/main_function_params.h" |
24 #include "content/common/result_codes.h" | 23 #include "content/common/result_codes.h" |
| 24 #include "ui/base/system_monitor/system_monitor.h" |
25 | 25 |
26 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
27 #include "chrome/nacl/broker_thread.h" | 27 #include "chrome/nacl/broker_thread.h" |
28 #include "sandbox/src/sandbox.h" | 28 #include "sandbox/src/sandbox.h" |
29 #endif | 29 #endif |
30 | 30 |
31 #ifdef _WIN64 | 31 #ifdef _WIN64 |
32 | 32 |
33 // main() routine for the NaCl broker process. | 33 // main() routine for the NaCl broker process. |
34 // This is necessary for supporting NaCl in Chrome on Win64. | 34 // This is necessary for supporting NaCl in Chrome on Win64. |
35 int NaClBrokerMain(const MainFunctionParams& parameters) { | 35 int NaClBrokerMain(const MainFunctionParams& parameters) { |
36 // The main thread of the broker. | 36 // The main thread of the broker. |
37 MessageLoopForIO main_message_loop; | 37 MessageLoopForIO main_message_loop; |
38 base::PlatformThread::SetName("CrNaClBrokerMain"); | 38 base::PlatformThread::SetName("CrNaClBrokerMain"); |
39 | 39 |
40 base::SystemMonitor system_monitor; | 40 ui::SystemMonitor system_monitor; |
41 HighResolutionTimerManager hi_res_timer_manager; | 41 HighResolutionTimerManager hi_res_timer_manager; |
42 | 42 |
43 const CommandLine& parsed_command_line = parameters.command_line_; | 43 const CommandLine& parsed_command_line = parameters.command_line_; |
44 | 44 |
45 DVLOG(1) << "Started NaCL broker with " | 45 DVLOG(1) << "Started NaCL broker with " |
46 << parsed_command_line.command_line_string(); | 46 << parsed_command_line.command_line_string(); |
47 | 47 |
48 // NOTE: this code is duplicated from browser_main.cc | 48 // NOTE: this code is duplicated from browser_main.cc |
49 // IMPORTANT: This piece of code needs to run as early as possible in the | 49 // IMPORTANT: This piece of code needs to run as early as possible in the |
50 // process because it will initialize the sandbox broker, which requires the | 50 // process because it will initialize the sandbox broker, which requires the |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // This function allows pausing execution using the --nacl-startup-dialog | 94 // This function allows pausing execution using the --nacl-startup-dialog |
95 // flag allowing us to attach a debugger. | 95 // flag allowing us to attach a debugger. |
96 // Do not move this function down since that would mean we can't easily debug | 96 // Do not move this function down since that would mean we can't easily debug |
97 // whatever occurs before it. | 97 // whatever occurs before it. |
98 HandleNaClTestParameters(parsed_command_line); | 98 HandleNaClTestParameters(parsed_command_line); |
99 | 99 |
100 // The main thread of the plugin services IO. | 100 // The main thread of the plugin services IO. |
101 MessageLoopForIO main_message_loop; | 101 MessageLoopForIO main_message_loop; |
102 base::PlatformThread::SetName("CrNaClMain"); | 102 base::PlatformThread::SetName("CrNaClMain"); |
103 | 103 |
104 base::SystemMonitor system_monitor; | 104 ui::SystemMonitor system_monitor; |
105 HighResolutionTimerManager hi_res_timer_manager; | 105 HighResolutionTimerManager hi_res_timer_manager; |
106 | 106 |
107 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 107 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
108 NaClMainPlatformDelegate platform(parameters); | 108 NaClMainPlatformDelegate platform(parameters); |
109 | 109 |
110 platform.PlatformInitialize(); | 110 platform.PlatformInitialize(); |
111 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); | 111 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); |
112 platform.InitSandboxTests(no_sandbox); | 112 platform.InitSandboxTests(no_sandbox); |
113 | 113 |
114 if (!no_sandbox) { | 114 if (!no_sandbox) { |
(...skipping 13 matching lines...) Expand all Loading... |
128 // require waiting for a timeout. | 128 // require waiting for a timeout. |
129 VLOG(1) << "Sandbox test failed: Not launching NaCl process"; | 129 VLOG(1) << "Sandbox test failed: Not launching NaCl process"; |
130 } | 130 } |
131 #else | 131 #else |
132 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc."; | 132 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc."; |
133 #endif | 133 #endif |
134 | 134 |
135 platform.PlatformUninitialize(); | 135 platform.PlatformUninitialize(); |
136 return 0; | 136 return 0; |
137 } | 137 } |
OLD | NEW |