From aa27148007a9ee460f4e5027fe8d3db7c3fc7246 Mon Sep 17 00:00:00 2001 From: "mbelshe@google.com" Date: Fri, 6 Feb 2009 06:25:03 +0000 Subject: Fix for http://code.google.com/p/chromium/issues/detail?id=7429 The problem is that webkit's timers are all based off the WTF/CurrentTime implementation, but the bridge was doing math between a webkit that implementation of currentTime and Chromium's base/Time implementation. Subtracting two different times leads to skew, which turned out to always be negative, so the CPU was spinning for most all timers. This bug was introduced during the merge which brought in timers. From the outside, functionality was correct (timers fired at the right time), but internally we could spin the CPU in while waiting for the timer to fire. There is some code to remove from SystemTimeChromium, which I will do, but that is in the webkit tree, so I'll do that separately. Review URL: http://codereview.chromium.org/21122 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9307 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/chromium_bridge_impl.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webkit/glue/chromium_bridge_impl.cc b/webkit/glue/chromium_bridge_impl.cc index 4780fa6..771c54b 100644 --- a/webkit/glue/chromium_bridge_impl.cc +++ b/webkit/glue/chromium_bridge_impl.cc @@ -24,6 +24,7 @@ #include "ScrollView.h" #include "SystemTime.h" #include "Widget.h" +#include #undef LOG #include "base/clipboard.h" @@ -489,7 +490,7 @@ void ChromiumBridge::setSharedTimerFiredFunction(void (*func)()) { void ChromiumBridge::setSharedTimerFireTime(double fire_time) { DCHECK(shared_timer_function); - int interval = static_cast((fire_time - currentTime()) * 1000); + int interval = static_cast((fire_time - WTF::currentTime()) * 1000); if (interval < 0) interval = 0; @@ -531,7 +532,8 @@ void ChromiumBridge::initV8CounterFunction() { // Called by SystemTimeChromium.cpp double ChromiumBridge::currentTime() { - // Get the current time in seconds since epoch. + // TODO(mbelshe): This can be deleted; SystemTimeChromium does not need this + // anymore. return base::Time::Now().ToDoubleT(); } -- cgit v1.1