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

Unified Diff: content/browser/power_monitor_message_broadcaster.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 | « content/browser/browser_main_loop.cc ('k') | content/browser/power_monitor_message_broadcaster_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/power_monitor_message_broadcaster.cc
diff --git a/content/browser/power_monitor_message_broadcaster.cc b/content/browser/power_monitor_message_broadcaster.cc
index 82affddbdba85691cec0fcc02b2921766fdbda1c..23de161b05c7225af72b1efb3dcd45c8545c879f 100644
--- a/content/browser/power_monitor_message_broadcaster.cc
+++ b/content/browser/power_monitor_message_broadcaster.cc
@@ -13,11 +13,15 @@
PowerMonitorMessageBroadcaster::PowerMonitorMessageBroadcaster(
IPC::Sender* sender)
: sender_(sender) {
- base::PowerMonitor::AddObserver(this);
+ base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
+ if (power_monitor)
+ power_monitor->AddObserver(this);
}
PowerMonitorMessageBroadcaster::~PowerMonitorMessageBroadcaster() {
- base::PowerMonitor::RemoveObserver(this);
+ base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
+ if (power_monitor)
+ power_monitor->RemoveObserver(this);
}
void PowerMonitorMessageBroadcaster::OnPowerStateChange(bool on_battery_power) {
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/power_monitor_message_broadcaster_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698