diff options
author | John Reck <jreck@google.com> | 2012-05-18 19:26:22 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2012-05-18 20:48:55 -0700 |
commit | e7500725fc05f45543cecae55dced30571158608 (patch) | |
tree | fa2aa74a078dd030e30e8689295066621cece7d3 /Source | |
parent | 1e59a334a1203c7be3fff2f9dbf94fee5b879d20 (diff) | |
download | external_webkit-e7500725fc05f45543cecae55dced30571158608.zip external_webkit-e7500725fc05f45543cecae55dced30571158608.tar.gz external_webkit-e7500725fc05f45543cecae55dced30571158608.tar.bz2 |
Switch to a 4ms/1s timer
Bug: 6523124
Bug: 6523033
Use a 4ms timer for foreground tabs, and a 1s timer
for background tabs
Change-Id: Iea061d63adf82f6e17dd2d47d382fcdfc588b7d3
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebCore/platform/android/SharedTimerAndroid.cpp | 2 | ||||
-rw-r--r-- | Source/WebKit/android/jni/JavaBridge.cpp | 3 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 9 |
3 files changed, 10 insertions, 4 deletions
diff --git a/Source/WebCore/platform/android/SharedTimerAndroid.cpp b/Source/WebCore/platform/android/SharedTimerAndroid.cpp index a3f3db5..92223d5 100644 --- a/Source/WebCore/platform/android/SharedTimerAndroid.cpp +++ b/Source/WebCore/platform/android/SharedTimerAndroid.cpp @@ -51,7 +51,7 @@ void setSharedTimerFireTime(double fireTime) { long long timeInMs = static_cast<long long>((fireTime - WTF::currentTime()) * 1000); - ALOGV("setSharedTimerFireTime: in %ld millisec", timeInMs); + ALOGV("setSharedTimerFireTime: in %d millisec", (int)timeInMs); if (JavaSharedClient::GetTimerClient()) JavaSharedClient::GetTimerClient()->setSharedTimer(timeInMs); } diff --git a/Source/WebKit/android/jni/JavaBridge.cpp b/Source/WebKit/android/jni/JavaBridge.cpp index 4c8234b..9f89ccd 100644 --- a/Source/WebKit/android/jni/JavaBridge.cpp +++ b/Source/WebKit/android/jni/JavaBridge.cpp @@ -370,10 +370,7 @@ void JavaBridge::Finalize(JNIEnv* env, jobject obj) void JavaBridge::SharedTimerFired(JNIEnv* env, jobject) { if (sSharedTimerFiredCallback) - { - SkAutoMemoryUsageProbe mup("JavaBridge::sharedTimerFired"); sSharedTimerFiredCallback(); - } } void JavaBridge::SetCacheSize(JNIEnv* env, jobject obj, jint bytes) diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 73abb07..8838f14 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -171,6 +171,9 @@ FILE* gRenderTreeFile = 0; #include "RenderLayerCompositor.h" #endif +#define FOREGROUND_TIMER_INTERVAL 0.004 // 4ms +#define BACKGROUND_TIMER_INTERVAL 1.0 // 1s + // How many ms to wait for the scroll to "settle" before we will consider doing // prerenders #define PRERENDER_AFTER_SCROLL_DELAY 750 @@ -549,6 +552,8 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m // HTML5 History API RuntimeEnabledFeatures::setPushStateEnabled(true); + if (m_mainFrame) + m_mainFrame->settings()->setMinDOMTimerInterval(FOREGROUND_TIMER_INTERVAL); } WebViewCore::~WebViewCore() @@ -4788,6 +4793,8 @@ static void Pause(JNIEnv* env, jobject obj, jint nativeClass) if (geolocation) geolocation->suspend(); } + if (mainFrame) + mainFrame->settings()->setMinDOMTimerInterval(BACKGROUND_TIMER_INTERVAL); viewImpl->deviceMotionAndOrientationManager()->maybeSuspendClients(); @@ -4808,6 +4815,8 @@ static void Resume(JNIEnv* env, jobject obj, jint nativeClass) if (geolocation) geolocation->resume(); } + if (mainFrame) + mainFrame->settings()->setMinDOMTimerInterval(FOREGROUND_TIMER_INTERVAL); viewImpl->deviceMotionAndOrientationManager()->maybeResumeClients(); |