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

Side by Side Diff: content/worker/worker_main.cc

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

Powered by Google App Engine
This is Rietveld 408576698