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

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 17074009: Created multi-process-friendly PowerMonitor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Further simplifying based on @piman's feedback 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/browser_main_loop.h" 5 #include "content/browser/browser_main_loop.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/pending_task.h" 14 #include "base/pending_task.h"
15 #include "base/power_monitor/power_monitor.h" 15 #include "base/power_monitor/power_monitor.h"
16 #include "base/power_monitor/power_monitor_device_source.h"
16 #include "base/process/process_metrics.h" 17 #include "base/process/process_metrics.h"
17 #include "base/run_loop.h" 18 #include "base/run_loop.h"
18 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
19 #include "base/system_monitor/system_monitor.h" 20 #include "base/system_monitor/system_monitor.h"
20 #include "base/threading/thread_restrictions.h" 21 #include "base/threading/thread_restrictions.h"
21 #include "base/timer/hi_res_timer_manager.h" 22 #include "base/timer/hi_res_timer_manager.h"
22 #include "content/browser/browser_thread_impl.h" 23 #include "content/browser/browser_thread_impl.h"
23 #include "content/browser/device_orientation/device_motion_service.h" 24 #include "content/browser/device_orientation/device_motion_service.h"
24 #include "content/browser/download/save_file_manager.h" 25 #include "content/browser/download/save_file_manager.h"
25 #include "content/browser/gamepad/gamepad_service.h" 26 #include "content/browser/gamepad/gamepad_service.h"
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 main_message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); 388 main_message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
388 389
389 InitializeMainThread(); 390 InitializeMainThread();
390 391
391 { 392 {
392 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SystemMonitor") 393 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SystemMonitor")
393 system_monitor_.reset(new base::SystemMonitor); 394 system_monitor_.reset(new base::SystemMonitor);
394 } 395 }
395 { 396 {
396 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:PowerMonitor") 397 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:PowerMonitor")
397 power_monitor_.reset(new base::PowerMonitor); 398 scoped_ptr<base::PowerMonitorSource> power_monitor_source(
399 new base::PowerMonitorDeviceSource());
400 power_monitor_.reset(new base::PowerMonitor(power_monitor_source.Pass()));
398 } 401 }
399 { 402 {
400 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:HighResTimerManager") 403 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:HighResTimerManager")
401 hi_res_timer_manager_.reset(new base::HighResolutionTimerManager); 404 hi_res_timer_manager_.reset(new base::HighResolutionTimerManager);
402 } 405 }
403 { 406 {
404 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:NetworkChangeNotifier") 407 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:NetworkChangeNotifier")
405 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); 408 network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
406 } 409 }
407 410
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 if (parameters_.ui_task) 904 if (parameters_.ui_task)
902 base::MessageLoopForUI::current()->PostTask(FROM_HERE, 905 base::MessageLoopForUI::current()->PostTask(FROM_HERE,
903 *parameters_.ui_task); 906 *parameters_.ui_task);
904 907
905 base::RunLoop run_loop; 908 base::RunLoop run_loop;
906 run_loop.Run(); 909 run_loop.Run();
907 #endif 910 #endif
908 } 911 }
909 912
910 } // namespace content 913 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698