Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: content/utility/utility_main.cc

Issue 10959020: SystemMonitor refactoring: move power state monitor into a separate class called PowerMonitor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use PowerMonitor instead of SystemMonitor in XXXMain function Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/hi_res_timer_manager.h" 6 #include "base/hi_res_timer_manager.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/system_monitor/system_monitor.h" 8 #include "base/power_monitor/power_monitor.h"
9 #include "base/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
10 #include "content/common/child_process.h" 10 #include "content/common/child_process.h"
11 #include "content/public/common/content_switches.h" 11 #include "content/public/common/content_switches.h"
12 #include "content/public/common/main_function_params.h" 12 #include "content/public/common/main_function_params.h"
13 #include "content/public/common/sandbox_init.h" 13 #include "content/public/common/sandbox_init.h"
14 #include "content/utility/utility_thread_impl.h" 14 #include "content/utility/utility_thread_impl.h"
15 15
16 #if defined(OS_WIN) 16 #if defined(OS_WIN)
17 #include "sandbox/win/src/sandbox.h" 17 #include "sandbox/win/src/sandbox.h"
18 #endif 18 #endif
19 19
20 namespace content { 20 namespace content {
21 21
22 // Mainline routine for running as the utility process. 22 // Mainline routine for running as the utility process.
23 int UtilityMain(const MainFunctionParams& parameters) { 23 int UtilityMain(const MainFunctionParams& parameters) {
24 // The main message loop of the utility process. 24 // The main message loop of the utility process.
25 MessageLoop main_message_loop; 25 MessageLoop main_message_loop;
26 base::PlatformThread::SetName("CrUtilityMain"); 26 base::PlatformThread::SetName("CrUtilityMain");
27 27
28 base::SystemMonitor system_monitor; 28 base::PowerMonitor power_monitor;
29 HighResolutionTimerManager hi_res_timer_manager; 29 HighResolutionTimerManager hi_res_timer_manager;
30 30
31 #if defined(OS_LINUX) 31 #if defined(OS_LINUX)
32 // Initialize the sandbox before any thread is created. 32 // Initialize the sandbox before any thread is created.
33 InitializeSandbox(); 33 InitializeSandbox();
34 #endif 34 #endif
35 35
36 ChildProcess utility_process; 36 ChildProcess utility_process;
37 utility_process.set_main_thread(new UtilityThreadImpl()); 37 utility_process.set_main_thread(new UtilityThreadImpl());
38 38
39 #if defined(OS_WIN) 39 #if defined(OS_WIN)
40 bool no_sandbox = parameters.command_line.HasSwitch(switches::kNoSandbox); 40 bool no_sandbox = parameters.command_line.HasSwitch(switches::kNoSandbox);
41 if (!no_sandbox) { 41 if (!no_sandbox) {
42 sandbox::TargetServices* target_services = 42 sandbox::TargetServices* target_services =
43 parameters.sandbox_info->target_services; 43 parameters.sandbox_info->target_services;
44 if (!target_services) 44 if (!target_services)
45 return false; 45 return false;
46 target_services->LowerToken(); 46 target_services->LowerToken();
47 } 47 }
48 #endif 48 #endif
49 49
50 MessageLoop::current()->Run(); 50 MessageLoop::current()->Run();
51 51
52 return 0; 52 return 0;
53 } 53 }
54 54
55 } // namespace content 55 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698