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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/system_monitor/system_monitor.h" | 7 #include "base/system_monitor/system_monitor.h" |
8 #include "base/threading/platform_thread.h" | |
9 #include "content/common/child_process.h" | 8 #include "content/common/child_process.h" |
10 #include "content/common/content_switches.h" | 9 #include "content/common/content_switches.h" |
11 #include "content/common/hi_res_timer_manager.h" | 10 #include "content/common/hi_res_timer_manager.h" |
12 #include "content/common/main_function_params.h" | 11 #include "content/common/main_function_params.h" |
13 #include "content/utility/utility_thread.h" | 12 #include "content/utility/utility_thread.h" |
14 | 13 |
15 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
16 #include "sandbox/src/sandbox.h" | 15 #include "sandbox/src/sandbox.h" |
17 #endif | 16 #endif |
18 | 17 |
19 // Mainline routine for running as the utility process. | 18 // Mainline routine for running as the utility process. |
20 int UtilityMain(const MainFunctionParams& parameters) { | 19 int UtilityMain(const MainFunctionParams& parameters) { |
21 // The main message loop of the utility process. | 20 // The main message loop of the utility process. |
22 MessageLoop main_message_loop; | 21 MessageLoop main_message_loop("CrUtilityMain"); |
23 base::PlatformThread::SetName("CrUtilityMain"); | |
24 | 22 |
25 base::SystemMonitor system_monitor; | 23 base::SystemMonitor system_monitor; |
26 HighResolutionTimerManager hi_res_timer_manager; | 24 HighResolutionTimerManager hi_res_timer_manager; |
27 | 25 |
28 ChildProcess utility_process; | 26 ChildProcess utility_process; |
29 utility_process.set_main_thread(new UtilityThread()); | 27 utility_process.set_main_thread(new UtilityThread()); |
30 | 28 |
31 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
32 bool no_sandbox = parameters.command_line_.HasSwitch(switches::kNoSandbox); | 30 bool no_sandbox = parameters.command_line_.HasSwitch(switches::kNoSandbox); |
33 if (!no_sandbox) { | 31 if (!no_sandbox) { |
34 sandbox::TargetServices* target_services = | 32 sandbox::TargetServices* target_services = |
35 parameters.sandbox_info_.TargetServices(); | 33 parameters.sandbox_info_.TargetServices(); |
36 if (!target_services) | 34 if (!target_services) |
37 return false; | 35 return false; |
38 target_services->LowerToken(); | 36 target_services->LowerToken(); |
39 } | 37 } |
40 #endif | 38 #endif |
41 | 39 |
42 MessageLoop::current()->Run(); | 40 MessageLoop::current()->Run(); |
43 | 41 |
44 return 0; | 42 return 0; |
45 } | 43 } |
OLD | NEW |