summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-06 06:25:03 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-06 06:25:03 +0000
commitaa27148007a9ee460f4e5027fe8d3db7c3fc7246 (patch)
tree73c6ebd2e92a1ddf7b5051f71161538648db8fcf
parent370aaefc438e950376f4b00df497491517e69962 (diff)
downloadchromium_src-aa27148007a9ee460f4e5027fe8d3db7c3fc7246.zip
chromium_src-aa27148007a9ee460f4e5027fe8d3db7c3fc7246.tar.gz
chromium_src-aa27148007a9ee460f4e5027fe8d3db7c3fc7246.tar.bz2
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
-rw-r--r--webkit/glue/chromium_bridge_impl.cc6
1 files 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 <wtf/CurrentTime.h>
#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<int>((fire_time - currentTime()) * 1000);
+ int interval = static_cast<int>((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();
}