summaryrefslogtreecommitdiffstats
path: root/base/time_win.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-01 17:59:38 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-01 17:59:38 +0000
commit4d9ae4ab9dd6d4f27c5cef5481f41979b3d58d1b (patch)
tree9978d5c639d3906ce700cc687170a6800243001b /base/time_win.cc
parent09d38ad48a2273d2e677e78d4828fa2c8bc65797 (diff)
downloadchromium_src-4d9ae4ab9dd6d4f27c5cef5481f41979b3d58d1b.zip
chromium_src-4d9ae4ab9dd6d4f27c5cef5481f41979b3d58d1b.tar.gz
chromium_src-4d9ae4ab9dd6d4f27c5cef5481f41979b3d58d1b.tar.bz2
Simplify the PowerObserver API by removing unneeded args and providing default implementations.
This also makes all the subclasses use the same code to add/remove observers. BUG=none TEST=none Review URL: http://codereview.chromium.org/244054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27740 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/time_win.cc')
-rw-r--r--base/time_win.cc22
1 files changed, 9 insertions, 13 deletions
diff --git a/base/time_win.cc b/base/time_win.cc
index c134a9e..9fdcab1 100644
--- a/base/time_win.cc
+++ b/base/time_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -104,29 +104,25 @@ class HighResolutionTimerManager : public base::SystemMonitor::PowerObserver {
if (is_monitoring_)
return;
is_monitoring_ = true;
- base::SystemMonitor* system = base::SystemMonitor::Get();
- DCHECK(system);
- system->AddObserver(this);
- UseHiResClock(!system->BatteryPower());
+ base::SystemMonitor* system_monitor = base::SystemMonitor::Get();
+ system_monitor->AddObserver(this);
+ UseHiResClock(!system_monitor->BatteryPower());
}
void StopMonitoring() {
if (!is_monitoring_)
return;
is_monitoring_ = false;
- base::SystemMonitor* monitor = base::SystemMonitor::Get();
- if (monitor)
- monitor->RemoveObserver(this);
+ base::SystemMonitor* system_monitor = base::SystemMonitor::Get();
+ if (system_monitor)
+ system_monitor->RemoveObserver(this);
}
// Interfaces for monitoring Power changes.
- void OnPowerStateChange(base::SystemMonitor* system) {
- UseHiResClock(!system->BatteryPower());
+ void OnPowerStateChange(bool on_battery_power) {
+ UseHiResClock(!on_battery_power);
}
- void OnSuspend(base::SystemMonitor* system) {}
- void OnResume(base::SystemMonitor* system) {}
-
private:
HighResolutionTimerManager()
: is_monitoring_(false),