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

Unified Diff: content/child/child_thread.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, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/child/child_thread.cc
diff --git a/content/child/child_thread.cc b/content/child/child_thread.cc
index e38e3a5856e224eee4febc43777728d909a92000..d5b758e8e3ff6616983170710b7e3c7f79222f85 100644
--- a/content/child/child_thread.cc
+++ b/content/child/child_thread.cc
@@ -259,13 +259,13 @@ void ChildThread::Init() {
channel_->AddFilter(service_worker_message_filter_->GetFilter());
// In single process mode we may already have a power monitor
- if (!base::PowerMonitor::Get()) {
+ if (!base::PowerMonitor::IsInitialized()) {
scoped_ptr<PowerMonitorBroadcastSource> power_monitor_source(
- new PowerMonitorBroadcastSource());
+ new PowerMonitorBroadcastSource());
channel_->AddFilter(power_monitor_source->GetMessageFilter());
- power_monitor_.reset(new base::PowerMonitor(
- power_monitor_source.PassAs<base::PowerMonitorSource>()));
+ base::PowerMonitor::Initialize(
+ power_monitor_source.PassAs<base::PowerMonitorSource>());
}
#if defined(OS_POSIX)
@@ -308,6 +308,8 @@ ChildThread::~ChildThread() {
channel_->RemoveFilter(histogram_message_filter_.get());
channel_->RemoveFilter(sync_message_filter_.get());
+ base::PowerMonitor::Shutdown();
+
// The ChannelProxy object caches a pointer to the IPC thread, so need to
// reset it as it's not guaranteed to outlive this object.
// NOTE: this also has the side-effect of not closing the main IPC channel to

Powered by Google App Engine
This is Rietveld 408576698