summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/jni/WebViewCore.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-05-18 19:26:22 -0700
committerJohn Reck <jreck@google.com>2012-05-18 20:48:55 -0700
commite7500725fc05f45543cecae55dced30571158608 (patch)
treefa2aa74a078dd030e30e8689295066621cece7d3 /Source/WebKit/android/jni/WebViewCore.cpp
parent1e59a334a1203c7be3fff2f9dbf94fee5b879d20 (diff)
downloadexternal_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/WebKit/android/jni/WebViewCore.cpp')
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp9
1 files changed, 9 insertions, 0 deletions
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();