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