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

Unified Diff: base/power_monitor/power_monitor_source.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/power_monitor/power_monitor_source.h ('k') | base/power_monitor/power_monitor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/power_monitor/power_monitor_source.cc
diff --git a/base/power_monitor/power_monitor_source.cc b/base/power_monitor/power_monitor_source.cc
index 33f3d23d9a295244fc08160b84c2a61aaa01c08f..6868cb19e338e17b7d5c960b606b8f22845893da 100644
--- a/base/power_monitor/power_monitor_source.cc
+++ b/base/power_monitor/power_monitor_source.cc
@@ -22,11 +22,11 @@
}
void PowerMonitorSource::ProcessPowerEvent(PowerEvent event_id) {
- AutoLock lock(*PowerMonitor::GetLock());
- if (!PowerMonitor::IsInitializedLocked())
+ PowerMonitor* monitor = PowerMonitor::Get();
+ if (!monitor)
return;
- PowerMonitorSource* source = PowerMonitor::GetSource();
+ PowerMonitorSource* source = monitor->Source();
// Suppress duplicate notifications. Some platforms may
// send multiple notifications of the same event.
@@ -45,19 +45,19 @@
}
if (changed)
- PowerMonitor::NotifyPowerStateChange(new_on_battery_power);
+ monitor->NotifyPowerStateChange(new_on_battery_power);
}
break;
case RESUME_EVENT:
if (source->suspended_) {
source->suspended_ = false;
- PowerMonitor::NotifyResume();
+ monitor->NotifyResume();
}
break;
case SUSPEND_EVENT:
if (!source->suspended_) {
source->suspended_ = true;
- PowerMonitor::NotifySuspend();
+ monitor->NotifySuspend();
}
break;
}
« no previous file with comments | « base/power_monitor/power_monitor_source.h ('k') | base/power_monitor/power_monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698