From 7736000ab44e1662fa11b564fb22b44e1ac6b3e4 Mon Sep 17 00:00:00 2001 From: "jamesr@chromium.org" Date: Thu, 14 Jul 2011 20:29:37 +0000 Subject: Prepare for switching timer scheduling to monotonic time (TimeTicks) This adds an #ifdef guarded line to use WTF::monotonicIncreasingTime(), which in chrome is really base::TimeTicks, for the shared timer scheduling. This requires a multi-sided commit since it needs WebKit side changes as well, so the plan is to land this patch, land a WebKit patch that changes behavior and sets the #define, delete the #else branch from webkitclient_impl.cc, then delete the #define upstream. BUG=71256 TEST=none Review URL: http://codereview.chromium.org/7362007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92593 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/webkitclient_impl.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'webkit/glue') diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc index 07d0e3e..157b3d7 100644 --- a/webkit/glue/webkitclient_impl.cc +++ b/webkit/glue/webkitclient_impl.cc @@ -513,8 +513,14 @@ void WebKitClientImpl::setSharedTimerFireTime(double fire_time) { // needlessly looping if sleep times are too short even by small amounts. // This results in measurable performance degradation unless we use ceil() to // always round up the sleep times. +#ifdef WEBKIT_USE_MONOTONIC_CLOCK_FOR_TIMER_SCHEDULING + double intervalSeconds = fire_time - monotonicallyIncreasingTime(); + int64 interval = static_cast( + ceil(intervalSeconds) * base::Time::kMicrosecondsPerSecond); +#else int64 interval = static_cast( ceil((fire_time - currentTime()) * base::Time::kMicrosecondsPerSecond)); +#endif if (interval < 0) interval = 0; -- cgit v1.1