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

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

Issue 179923006: Attempting to resolve a race condition with PowerMonitor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactored to a more explicitly singleton-like style. Created 6 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 | 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/file_util.h" 10 #include "base/file_util.h"
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 441
442 InitializeMainThread(); 442 InitializeMainThread();
443 443
444 { 444 {
445 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SystemMonitor") 445 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SystemMonitor")
446 system_monitor_.reset(new base::SystemMonitor); 446 system_monitor_.reset(new base::SystemMonitor);
447 } 447 }
448 { 448 {
449 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:PowerMonitor") 449 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:PowerMonitor")
450 scoped_ptr<base::PowerMonitorSource> power_monitor_source( 450 scoped_ptr<base::PowerMonitorSource> power_monitor_source(
451 new base::PowerMonitorDeviceSource()); 451 new base::PowerMonitorDeviceSource());
452 power_monitor_.reset(new base::PowerMonitor(power_monitor_source.Pass())); 452 base::PowerMonitor::Initialize(power_monitor_source.Pass());
453 } 453 }
454 { 454 {
455 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:HighResTimerManager") 455 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:HighResTimerManager")
456 hi_res_timer_manager_.reset(new base::HighResolutionTimerManager); 456 hi_res_timer_manager_.reset(new base::HighResolutionTimerManager);
457 } 457 }
458 { 458 {
459 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:NetworkChangeNotifier") 459 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:NetworkChangeNotifier")
460 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); 460 network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
461 } 461 }
462 462
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 { 896 {
897 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:SensorService"); 897 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:SensorService");
898 DeviceInertialSensorService::GetInstance()->Shutdown(); 898 DeviceInertialSensorService::GetInstance()->Shutdown();
899 } 899 }
900 { 900 {
901 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DeleteDataSources"); 901 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DeleteDataSources");
902 URLDataManager::DeleteDataSources(); 902 URLDataManager::DeleteDataSources();
903 } 903 }
904 #endif // !defined(OS_IOS) 904 #endif // !defined(OS_IOS)
905 905
906 {
907 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:PowerMonitor");
908 base::PowerMonitor::Shutdown();
909 }
910
906 if (parts_) { 911 if (parts_) {
907 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:PostDestroyThreads"); 912 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:PostDestroyThreads");
908 parts_->PostDestroyThreads(); 913 parts_->PostDestroyThreads();
909 } 914 }
910 } 915 }
911 916
912 void BrowserMainLoop::InitializeMainThread() { 917 void BrowserMainLoop::InitializeMainThread() {
913 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeMainThread") 918 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeMainThread")
914 const char* kThreadName = "CrBrowserMain"; 919 const char* kThreadName = "CrBrowserMain";
915 base::PlatformThread::SetName(kThreadName); 920 base::PlatformThread::SetName(kThreadName);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 base::TimeDelta::FromSeconds(delay_secs)); 1129 base::TimeDelta::FromSeconds(delay_secs));
1125 } 1130 }
1126 1131
1127 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) { 1132 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) {
1128 is_tracing_startup_ = false; 1133 is_tracing_startup_ = false;
1129 TracingController::GetInstance()->DisableRecording( 1134 TracingController::GetInstance()->DisableRecording(
1130 trace_file, TracingController::TracingFileResultCallback()); 1135 trace_file, TracingController::TracingFileResultCallback());
1131 } 1136 }
1132 1137
1133 } // namespace content 1138 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698