diff options
author | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-20 03:53:13 +0000 |
---|---|---|
committer | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-20 03:53:13 +0000 |
commit | 32e9efbc0564ea718a7fb3b56d7ad934fefce70f (patch) | |
tree | 308e462dda8dc50008e9dfe26ae8b37c2705a2c7 /base/message_loop.cc | |
parent | 8f31f41edbe94651e1df889993be0704954942db (diff) | |
download | chromium_src-32e9efbc0564ea718a7fb3b56d7ad934fefce70f.zip chromium_src-32e9efbc0564ea718a7fb3b56d7ad934fefce70f.tar.gz chromium_src-32e9efbc0564ea718a7fb3b56d7ad934fefce70f.tar.bz2 |
Revert 63176 - 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/3848002
TBR=mbelshe@chromium.org
Review URL: http://codereview.chromium.org/3948001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63177 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_loop.cc')
-rw-r--r-- | base/message_loop.cc | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/base/message_loop.cc b/base/message_loop.cc index 0b03d3c..8f6c997b 100644 --- a/base/message_loop.cc +++ b/base/message_loop.cc @@ -179,16 +179,6 @@ MessageLoop::~MessageLoop() { // OK, now make it so that no one can find us. lazy_tls_ptr.Pointer()->Set(NULL); - -#if defined(OS_WIN) - // If we left the high-resolution timer activated, deactivate it now. - // Doing this is not-critical, it is mainly to make sure we track - // the high resolution timer activations properly in our unit tests. - if (!high_resolution_timer_expiration_.is_null()) { - Time::ActivateHighResolutionTimer(false); - high_resolution_timer_expiration_ = base::TimeTicks(); - } -#endif } void MessageLoop::AddDestructionObserver( @@ -347,10 +337,9 @@ void MessageLoop::PostTask_Helper( bool needs_high_res_timers = delay_ms < (2 * Time::kMinLowResolutionThresholdMs); if (needs_high_res_timers) { - if (Time::ActivateHighResolutionTimer(true)) { - high_resolution_timer_expiration_ = base::TimeTicks::Now() + - TimeDelta::FromMilliseconds(kHighResolutionTimerModeLeaseTimeMs); - } + Time::ActivateHighResolutionTimer(true); + high_resolution_timer_expiration_ = base::TimeTicks::Now() + + TimeDelta::FromMilliseconds(kHighResolutionTimerModeLeaseTimeMs); } } #endif |