summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-14 20:29:37 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-14 20:29:37 +0000
commit7736000ab44e1662fa11b564fb22b44e1ac6b3e4 (patch)
tree6861edc5e2a0200d040c0b34f47e9ac2b22570f2 /webkit/glue
parentfb0b6de9ebf451952e32faad2ac3a1087f93cb5a (diff)
downloadchromium_src-7736000ab44e1662fa11b564fb22b44e1ac6b3e4.zip
chromium_src-7736000ab44e1662fa11b564fb22b44e1ac6b3e4.tar.gz
chromium_src-7736000ab44e1662fa11b564fb22b44e1ac6b3e4.tar.bz2
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
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/webkitclient_impl.cc6
1 files changed, 6 insertions, 0 deletions
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<int64>(
+ ceil(intervalSeconds) * base::Time::kMicrosecondsPerSecond);
+#else
int64 interval = static_cast<int64>(
ceil((fire_time - currentTime()) * base::Time::kMicrosecondsPerSecond));
+#endif
if (interval < 0)
interval = 0;