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

Side by Side Diff: components/nacl/loader/nacl_main.cc

Issue 226263008: Revert of Attempting to resolve a race condition with PowerMonitor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
« no previous file with comments | « components/nacl/loader/nacl_helper_win_64.cc ('k') | content/browser/browser_main_loop.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "build/build_config.h" 5 #include "build/build_config.h"
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/timer/hi_res_timer_manager.h" 11 #include "base/timer/hi_res_timer_manager.h"
12 #include "components/nacl/loader/nacl_listener.h" 12 #include "components/nacl/loader/nacl_listener.h"
13 #include "components/nacl/loader/nacl_main_platform_delegate.h" 13 #include "components/nacl/loader/nacl_main_platform_delegate.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "content/public/common/main_function_params.h" 15 #include "content/public/common/main_function_params.h"
16 16
17 // main() routine for the NaCl loader process. 17 // main() routine for the NaCl loader process.
18 int NaClMain(const content::MainFunctionParams& parameters) { 18 int NaClMain(const content::MainFunctionParams& parameters) {
19 const CommandLine& parsed_command_line = parameters.command_line; 19 const CommandLine& parsed_command_line = parameters.command_line;
20 20
21 // The main thread of the plugin services IO. 21 // The main thread of the plugin services IO.
22 base::MessageLoopForIO main_message_loop; 22 base::MessageLoopForIO main_message_loop;
23 base::PlatformThread::SetName("CrNaClMain"); 23 base::PlatformThread::SetName("CrNaClMain");
24 24
25 scoped_ptr<base::PowerMonitorSource> power_monitor_source( 25 scoped_ptr<base::PowerMonitorSource> power_monitor_source(
26 new base::PowerMonitorDeviceSource()); 26 new base::PowerMonitorDeviceSource());
27 base::PowerMonitor::Initialize(power_monitor_source.Pass()); 27 base::PowerMonitor power_monitor(power_monitor_source.Pass());
28 base::HighResolutionTimerManager hi_res_timer_manager; 28 base::HighResolutionTimerManager hi_res_timer_manager;
29 29
30 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) 30 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
31 NaClMainPlatformDelegate platform(parameters); 31 NaClMainPlatformDelegate platform(parameters);
32 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); 32 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox);
33 33
34 #if defined(OS_POSIX) 34 #if defined(OS_POSIX)
35 // The number of cores must be obtained before the invocation of 35 // The number of cores must be obtained before the invocation of
36 // platform.EnableSandbox(), so cannot simply be inlined below. 36 // platform.EnableSandbox(), so cannot simply be inlined below.
37 int number_of_cores = sysconf(_SC_NPROCESSORS_ONLN); 37 int number_of_cores = sysconf(_SC_NPROCESSORS_ONLN);
38 #endif 38 #endif
39 39
40 if (!no_sandbox) { 40 if (!no_sandbox) {
41 platform.EnableSandbox(); 41 platform.EnableSandbox();
42 } 42 }
43 NaClListener listener; 43 NaClListener listener;
44 #if defined(OS_POSIX) 44 #if defined(OS_POSIX)
45 listener.set_number_of_cores(number_of_cores); 45 listener.set_number_of_cores(number_of_cores);
46 #endif 46 #endif
47 47
48 listener.Listen(); 48 listener.Listen();
49 #else 49 #else
50 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc."; 50 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc.";
51 #endif 51 #endif
52
53 return 0; 52 return 0;
54 } 53 }
OLDNEW
« no previous file with comments | « components/nacl/loader/nacl_helper_win_64.cc ('k') | content/browser/browser_main_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698