| 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/system_monitor/system_monitor.h" | 11 #include "base/system_monitor/system_monitor.h" |
| 12 #include "chrome/app/breakpad_win.h" | 12 #include "chrome/app/breakpad_win.h" |
| 13 #include "chrome/common/chrome_result_codes.h" | 13 #include "chrome/common/chrome_result_codes.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/logging_chrome.h" | 15 #include "chrome/common/logging_chrome.h" |
| 16 #include "chrome/nacl/nacl_broker_listener.h" | 16 #include "chrome/nacl/nacl_broker_listener.h" |
| 17 #include "chrome/nacl/nacl_listener.h" | 17 #include "chrome/nacl/nacl_listener.h" |
| 18 #include "chrome/nacl/nacl_main_platform_delegate.h" | 18 #include "chrome/nacl/nacl_main_platform_delegate.h" |
| 19 #include "content/common/hi_res_timer_manager.h" | 19 #include "content/common/hi_res_timer_manager.h" |
| 20 #include "content/common/main_function_params.h" | |
| 21 #include "content/public/app/startup_helper_win.h" | 20 #include "content/public/app/startup_helper_win.h" |
| 21 #include "content/public/common/main_function_params.h" |
| 22 #include "content/public/common/sandbox_init.h" | 22 #include "content/public/common/sandbox_init.h" |
| 23 #include "sandbox/src/sandbox_types.h" | 23 #include "sandbox/src/sandbox_types.h" |
| 24 | 24 |
| 25 extern int NaClMain(const MainFunctionParams&); | 25 extern int NaClMain(const content::MainFunctionParams&); |
| 26 | 26 |
| 27 // main() routine for the NaCl broker process. | 27 // main() routine for the NaCl broker process. |
| 28 // This is necessary for supporting NaCl in Chrome on Win64. | 28 // This is necessary for supporting NaCl in Chrome on Win64. |
| 29 int NaClBrokerMain(const MainFunctionParams& parameters) { | 29 int NaClBrokerMain(const content::MainFunctionParams& parameters) { |
| 30 const CommandLine& parsed_command_line = parameters.command_line; | 30 const CommandLine& parsed_command_line = parameters.command_line; |
| 31 | 31 |
| 32 MessageLoopForIO main_message_loop; | 32 MessageLoopForIO main_message_loop; |
| 33 base::PlatformThread::SetName("CrNaClBrokerMain"); | 33 base::PlatformThread::SetName("CrNaClBrokerMain"); |
| 34 | 34 |
| 35 base::SystemMonitor system_monitor; | 35 base::SystemMonitor system_monitor; |
| 36 HighResolutionTimerManager hi_res_timer_manager; | 36 HighResolutionTimerManager hi_res_timer_manager; |
| 37 | 37 |
| 38 NaClBrokerListener listener; | 38 NaClBrokerListener listener; |
| 39 listener.Listen(); | 39 listener.Listen(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 60 base::EnableTerminationOnHeapCorruption(); | 60 base::EnableTerminationOnHeapCorruption(); |
| 61 base::EnableTerminationOnOutOfMemory(); | 61 base::EnableTerminationOnOutOfMemory(); |
| 62 content::RegisterInvalidParamHandler(); | 62 content::RegisterInvalidParamHandler(); |
| 63 content::SetupCRT(command_line); | 63 content::SetupCRT(command_line); |
| 64 | 64 |
| 65 // Initialize the sandbox for this process. | 65 // Initialize the sandbox for this process. |
| 66 bool sandbox_initialized_ok = content::InitializeSandbox(&sandbox_info); | 66 bool sandbox_initialized_ok = content::InitializeSandbox(&sandbox_info); |
| 67 // Die if the sandbox can't be enabled. | 67 // Die if the sandbox can't be enabled. |
| 68 CHECK(sandbox_initialized_ok) << "Error initializing sandbox for " | 68 CHECK(sandbox_initialized_ok) << "Error initializing sandbox for " |
| 69 << process_type; | 69 << process_type; |
| 70 MainFunctionParams main_params(command_line); | 70 content::MainFunctionParams main_params(command_line); |
| 71 main_params.sandbox_info = &sandbox_info; | 71 main_params.sandbox_info = &sandbox_info; |
| 72 | 72 |
| 73 if (process_type == switches::kNaClLoaderProcess) | 73 if (process_type == switches::kNaClLoaderProcess) |
| 74 return NaClMain(main_params); | 74 return NaClMain(main_params); |
| 75 | 75 |
| 76 if (process_type == switches::kNaClBrokerProcess) | 76 if (process_type == switches::kNaClBrokerProcess) |
| 77 return NaClBrokerMain(main_params); | 77 return NaClBrokerMain(main_params); |
| 78 | 78 |
| 79 CHECK(false) << "Unknown NaCl 64 process."; | 79 CHECK(false) << "Unknown NaCl 64 process."; |
| 80 return -1; | 80 return -1; |
| 81 } | 81 } |
| OLD | NEW |