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

Unified Diff: base/message_loop.cc

Issue 3889004: 2nd try:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 | « app/hi_res_timer_manager_win.cc ('k') | base/time.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop.cc
===================================================================
--- base/message_loop.cc (revision 63177)
+++ base/message_loop.cc (working copy)
@@ -179,6 +179,16 @@
// 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(
@@ -337,9 +347,10 @@
bool needs_high_res_timers =
delay_ms < (2 * Time::kMinLowResolutionThresholdMs);
if (needs_high_res_timers) {
- Time::ActivateHighResolutionTimer(true);
- high_resolution_timer_expiration_ = base::TimeTicks::Now() +
- TimeDelta::FromMilliseconds(kHighResolutionTimerModeLeaseTimeMs);
+ if (Time::ActivateHighResolutionTimer(true)) {
+ high_resolution_timer_expiration_ = base::TimeTicks::Now() +
+ TimeDelta::FromMilliseconds(kHighResolutionTimerModeLeaseTimeMs);
+ }
}
}
#endif
« no previous file with comments | « app/hi_res_timer_manager_win.cc ('k') | base/time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698