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 <utility> | 5 #include <utility> |
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/power_monitor/power_monitor_device_source.h" |
| 11 #include "base/task_scheduler/task_scheduler.h" |
11 #include "base/timer/hi_res_timer_manager.h" | 12 #include "base/timer/hi_res_timer_manager.h" |
12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
13 #include "components/nacl/loader/nacl_listener.h" | 14 #include "components/nacl/loader/nacl_listener.h" |
14 #include "components/nacl/loader/nacl_main_platform_delegate.h" | 15 #include "components/nacl/loader/nacl_main_platform_delegate.h" |
15 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
16 #include "content/public/common/main_function_params.h" | 17 #include "content/public/common/main_function_params.h" |
17 #include "mojo/edk/embedder/embedder.h" | 18 #include "mojo/edk/embedder/embedder.h" |
18 | 19 |
19 // main() routine for the NaCl loader process. | 20 // main() routine for the NaCl loader process. |
20 int NaClMain(const content::MainFunctionParams& parameters) { | 21 int NaClMain(const content::MainFunctionParams& parameters) { |
21 const base::CommandLine& parsed_command_line = parameters.command_line; | 22 const base::CommandLine& parsed_command_line = parameters.command_line; |
22 | 23 |
23 // The Mojo EDK must be initialized before using IPC. | 24 // The Mojo EDK must be initialized before using IPC. |
24 mojo::edk::Init(); | 25 mojo::edk::Init(); |
25 | 26 |
26 // The main thread of the plugin services IO. | 27 // The main thread of the plugin services IO. |
27 base::MessageLoopForIO main_message_loop; | 28 base::MessageLoopForIO main_message_loop; |
28 base::PlatformThread::SetName("CrNaClMain"); | 29 base::PlatformThread::SetName("CrNaClMain"); |
29 | 30 |
| 31 base::TaskScheduler::CreateAndStartWithDefaultParams("NaCl"); |
| 32 |
30 std::unique_ptr<base::PowerMonitorSource> power_monitor_source( | 33 std::unique_ptr<base::PowerMonitorSource> power_monitor_source( |
31 new base::PowerMonitorDeviceSource()); | 34 new base::PowerMonitorDeviceSource()); |
32 base::PowerMonitor power_monitor(std::move(power_monitor_source)); | 35 base::PowerMonitor power_monitor(std::move(power_monitor_source)); |
33 base::HighResolutionTimerManager hi_res_timer_manager; | 36 base::HighResolutionTimerManager hi_res_timer_manager; |
34 | 37 |
35 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ | 38 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ |
36 defined(OS_ANDROID) | 39 defined(OS_ANDROID) |
37 NaClMainPlatformDelegate platform; | 40 NaClMainPlatformDelegate platform; |
38 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); | 41 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); |
39 | 42 |
(...skipping 10 matching lines...) Expand all Loading... |
50 #if defined(OS_POSIX) | 53 #if defined(OS_POSIX) |
51 listener.set_number_of_cores(number_of_cores); | 54 listener.set_number_of_cores(number_of_cores); |
52 #endif | 55 #endif |
53 | 56 |
54 listener.Listen(); | 57 listener.Listen(); |
55 #else | 58 #else |
56 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc."; | 59 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc."; |
57 #endif | 60 #endif |
58 return 0; | 61 return 0; |
59 } | 62 } |
OLD | NEW |