| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/power_monitor/power_monitor.h" | 9 #include "base/power_monitor/power_monitor.h" |
| 10 #include "base/power_monitor/power_monitor_device_source.h" |
| 10 #include "base/timer/hi_res_timer_manager.h" | 11 #include "base/timer/hi_res_timer_manager.h" |
| 11 #include "components/nacl/loader/nacl_listener.h" | 12 #include "components/nacl/loader/nacl_listener.h" |
| 12 #include "components/nacl/loader/nacl_main_platform_delegate.h" | 13 #include "components/nacl/loader/nacl_main_platform_delegate.h" |
| 13 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 14 #include "content/public/common/main_function_params.h" | 15 #include "content/public/common/main_function_params.h" |
| 15 | 16 |
| 16 // main() routine for the NaCl loader process. | 17 // main() routine for the NaCl loader process. |
| 17 int NaClMain(const content::MainFunctionParams& parameters) { | 18 int NaClMain(const content::MainFunctionParams& parameters) { |
| 18 const CommandLine& parsed_command_line = parameters.command_line; | 19 const CommandLine& parsed_command_line = parameters.command_line; |
| 19 | 20 |
| 20 // The main thread of the plugin services IO. | 21 // The main thread of the plugin services IO. |
| 21 base::MessageLoopForIO main_message_loop; | 22 base::MessageLoopForIO main_message_loop; |
| 22 base::PlatformThread::SetName("CrNaClMain"); | 23 base::PlatformThread::SetName("CrNaClMain"); |
| 23 | 24 |
| 24 base::PowerMonitor power_monitor; | 25 scoped_ptr<base::PowerMonitorSource> power_monitor_source( |
| 26 new base::PowerMonitorDeviceSource()); |
| 27 base::PowerMonitor power_monitor(power_monitor_source.Pass()); |
| 25 base::HighResolutionTimerManager hi_res_timer_manager; | 28 base::HighResolutionTimerManager hi_res_timer_manager; |
| 26 | 29 |
| 27 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 30 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
| 28 NaClMainPlatformDelegate platform(parameters); | 31 NaClMainPlatformDelegate platform(parameters); |
| 29 | 32 |
| 30 platform.PlatformInitialize(); | 33 platform.PlatformInitialize(); |
| 31 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); | 34 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); |
| 32 platform.InitSandboxTests(no_sandbox); | 35 platform.InitSandboxTests(no_sandbox); |
| 33 | 36 |
| 34 #if defined(OS_POSIX) | 37 #if defined(OS_POSIX) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 55 // require waiting for a timeout. | 58 // require waiting for a timeout. |
| 56 VLOG(1) << "Sandbox test failed: Not launching NaCl process"; | 59 VLOG(1) << "Sandbox test failed: Not launching NaCl process"; |
| 57 } | 60 } |
| 58 #else | 61 #else |
| 59 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc."; | 62 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc."; |
| 60 #endif | 63 #endif |
| 61 | 64 |
| 62 platform.PlatformUninitialize(); | 65 platform.PlatformUninitialize(); |
| 63 return 0; | 66 return 0; |
| 64 } | 67 } |
| OLD | NEW |