summaryrefslogtreecommitdiffstats
path: root/content/common/hi_res_timer_manager_win.cc
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-15 19:20:49 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-15 19:20:49 +0000
commit14255a99d1709414d9b5419329e19bf9bd8406b7 (patch)
tree18616ca60c09839db53690e8c127f5972ca76899 /content/common/hi_res_timer_manager_win.cc
parent3f20a2191bdac8e08bc1572913d5aa4a17df930c (diff)
downloadchromium_src-14255a99d1709414d9b5419329e19bf9bd8406b7.zip
chromium_src-14255a99d1709414d9b5419329e19bf9bd8406b7.tar.gz
chromium_src-14255a99d1709414d9b5419329e19bf9bd8406b7.tar.bz2
Reland old fix that was reverted incorrectly.
Fix regression where high resolution timers could be activated even under battery power. Add unit test to protect chromium from developers like me in the future. The fix is a one-liner in hi_res_timer_manager_win.cc. The rest of the code change is the mechanics to enable the unit test. BUG=59528 TEST=HiResTimerManagerTest.ToggleOnOff Review URL: http://codereview.chromium.org/6904117 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85413 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/hi_res_timer_manager_win.cc')
-rw-r--r--content/common/hi_res_timer_manager_win.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/content/common/hi_res_timer_manager_win.cc b/content/common/hi_res_timer_manager_win.cc
index 9c86fa0..d41c4bd 100644
--- a/content/common/hi_res_timer_manager_win.cc
+++ b/content/common/hi_res_timer_manager_win.cc
@@ -7,7 +7,7 @@
#include "base/time.h"
HighResolutionTimerManager::HighResolutionTimerManager()
- : hi_res_clock_used_(false) {
+ : hi_res_clock_available_(false) {
ui::SystemMonitor* system_monitor = ui::SystemMonitor::Get();
system_monitor->AddObserver(this);
UseHiResClock(!system_monitor->BatteryPower());
@@ -23,7 +23,8 @@ void HighResolutionTimerManager::OnPowerStateChange(bool on_battery_power) {
}
void HighResolutionTimerManager::UseHiResClock(bool use) {
- if (use == hi_res_clock_used_)
+ if (use == hi_res_clock_available_)
return;
+ hi_res_clock_available_ = use;
base::Time::EnableHighResolutionTimer(use);
}