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/base_switches.h" | 5 #include "base/base_switches.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/hi_res_timer_manager.h" | |
8 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
9 #include "base/power_monitor/power_monitor.h" | 8 #include "base/power_monitor/power_monitor.h" |
10 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
11 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
| 11 #include "base/timer/hi_res_timer_manager.h" |
12 #include "content/child/child_process.h" | 12 #include "content/child/child_process.h" |
13 #include "content/common/sandbox_linux.h" | 13 #include "content/common/sandbox_linux.h" |
14 #include "content/public/common/main_function_params.h" | 14 #include "content/public/common/main_function_params.h" |
15 #include "content/public/common/sandbox_init.h" | 15 #include "content/public/common/sandbox_init.h" |
16 #include "content/worker/worker_thread.h" | 16 #include "content/worker/worker_thread.h" |
17 | 17 |
18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
19 #include "sandbox/win/src/sandbox.h" | 19 #include "sandbox/win/src/sandbox.h" |
20 #endif | 20 #endif |
21 | 21 |
22 #if defined(OS_MACOSX) | 22 #if defined(OS_MACOSX) |
23 #include "content/common/sandbox_mac.h" | 23 #include "content/common/sandbox_mac.h" |
24 #endif | 24 #endif |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 | 27 |
28 // Mainline routine for running as the worker process. | 28 // Mainline routine for running as the worker process. |
29 int WorkerMain(const MainFunctionParams& parameters) { | 29 int WorkerMain(const MainFunctionParams& parameters) { |
30 // The main message loop of the worker process. | 30 // The main message loop of the worker process. |
31 base::MessageLoop main_message_loop; | 31 base::MessageLoop main_message_loop; |
32 base::PlatformThread::SetName("CrWorkerMain"); | 32 base::PlatformThread::SetName("CrWorkerMain"); |
33 | 33 |
34 base::PowerMonitor power_monitor; | 34 base::PowerMonitor power_monitor; |
35 HighResolutionTimerManager hi_res_timer_manager; | 35 base::HighResolutionTimerManager hi_res_timer_manager; |
36 | 36 |
37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
38 sandbox::TargetServices* target_services = | 38 sandbox::TargetServices* target_services = |
39 parameters.sandbox_info->target_services; | 39 parameters.sandbox_info->target_services; |
40 if (!target_services) | 40 if (!target_services) |
41 return false; | 41 return false; |
42 | 42 |
43 // Cause advapi32 to load before the sandbox is turned on. | 43 // Cause advapi32 to load before the sandbox is turned on. |
44 unsigned int dummy_rand; | 44 unsigned int dummy_rand; |
45 rand_s(&dummy_rand); | 45 rand_s(&dummy_rand); |
(...skipping 20 matching lines...) Expand all Loading... |
66 } | 66 } |
67 | 67 |
68 // Load the accelerator table from the browser executable and tell the | 68 // Load the accelerator table from the browser executable and tell the |
69 // message loop to use it when translating messages. | 69 // message loop to use it when translating messages. |
70 base::MessageLoop::current()->Run(); | 70 base::MessageLoop::current()->Run(); |
71 | 71 |
72 return 0; | 72 return 0; |
73 } | 73 } |
74 | 74 |
75 } // namespace content | 75 } // namespace content |
OLD | NEW |