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 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/system_monitor/system_monitor.h" | 9 #include "base/system_monitor/system_monitor.h" |
10 #include "chrome/common/chrome_result_codes.h" | 10 #include "chrome/common/chrome_result_codes.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/logging_chrome.h" | 12 #include "chrome/common/logging_chrome.h" |
13 #include "chrome/nacl/nacl_listener.h" | 13 #include "chrome/nacl/nacl_listener.h" |
14 #include "chrome/nacl/nacl_main_platform_delegate.h" | 14 #include "chrome/nacl/nacl_main_platform_delegate.h" |
15 #include "content/common/child_process.h" | |
16 #include "content/common/hi_res_timer_manager.h" | 15 #include "content/common/hi_res_timer_manager.h" |
17 #include "content/public/common/main_function_params.h" | 16 #include "content/public/common/main_function_params.h" |
18 | 17 |
19 // This function provides some ways to test crash and assertion handling | |
20 // behavior of the renderer. | |
21 static void HandleNaClTestParameters(const CommandLine& command_line) { | |
22 // The message box doesn't work in the 64 bit binaries anyways, so no need to | |
23 // link to it since the 64 bit binary doesn't link with chrome or content. | |
24 #if !defined(NACL_WIN64) | |
25 if (command_line.HasSwitch(switches::kNaClStartupDialog)) { | |
26 ChildProcess::WaitForDebugger("NativeClient"); | |
27 } | |
28 #endif | |
29 } | |
30 | |
31 // main() routine for the NaCl loader process. | 18 // main() routine for the NaCl loader process. |
32 int NaClMain(const content::MainFunctionParams& parameters) { | 19 int NaClMain(const content::MainFunctionParams& parameters) { |
33 const CommandLine& parsed_command_line = parameters.command_line; | 20 const CommandLine& parsed_command_line = parameters.command_line; |
34 | 21 |
35 // This function allows pausing execution using the --nacl-startup-dialog | |
36 // flag allowing us to attach a debugger. | |
37 // Do not move this function down since that would mean we can't easily debug | |
38 // whatever occurs before it. | |
39 HandleNaClTestParameters(parsed_command_line); | |
40 | |
41 // The main thread of the plugin services IO. | 22 // The main thread of the plugin services IO. |
42 MessageLoopForIO main_message_loop; | 23 MessageLoopForIO main_message_loop; |
43 base::PlatformThread::SetName("CrNaClMain"); | 24 base::PlatformThread::SetName("CrNaClMain"); |
44 | 25 |
45 base::SystemMonitor system_monitor; | 26 base::SystemMonitor system_monitor; |
46 HighResolutionTimerManager hi_res_timer_manager; | 27 HighResolutionTimerManager hi_res_timer_manager; |
47 | 28 |
48 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 29 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
49 NaClMainPlatformDelegate platform(parameters); | 30 NaClMainPlatformDelegate platform(parameters); |
50 | 31 |
(...skipping 18 matching lines...) Expand all Loading... |
69 // require waiting for a timeout. | 50 // require waiting for a timeout. |
70 VLOG(1) << "Sandbox test failed: Not launching NaCl process"; | 51 VLOG(1) << "Sandbox test failed: Not launching NaCl process"; |
71 } | 52 } |
72 #else | 53 #else |
73 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc."; | 54 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc."; |
74 #endif | 55 #endif |
75 | 56 |
76 platform.PlatformUninitialize(); | 57 platform.PlatformUninitialize(); |
77 return 0; | 58 return 0; |
78 } | 59 } |
OLD | NEW |