Merge "actually pause webkit thread, remove costly invalidate"

This commit is contained in:
Chris Craik
2011-08-25 15:13:39 -07:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 8 deletions

View File

@@ -3451,6 +3451,7 @@ public class WebView extends AbsoluteLayout
}
abortAnimation();
mPrivateHandler.removeMessages(RESUME_WEBCORE_PRIORITY);
nativeSetIsScrolling(false);
if (!mBlockWebkitViewMessages) {
WebViewCore.resumePriority();
if (!mSelectingText) {
@@ -6382,6 +6383,8 @@ public class WebView extends AbsoluteLayout
WebViewCore.reducePriority();
// to get better performance, pause updating the picture
WebViewCore.pauseUpdatePicture(mWebViewCore);
nativeSetIsScrolling(true);
if (!mDragFromTextInput) {
nativeHideCursor();
}
@@ -6478,6 +6481,7 @@ public class WebView extends AbsoluteLayout
|| mTouchMode == TOUCH_DRAG_LAYER_MODE) && !mSelectingText) {
WebViewCore.resumePriority();
WebViewCore.resumeUpdatePicture(mWebViewCore);
nativeSetIsScrolling(false);
}
mPrivateHandler.removeMessages(SWITCH_TO_SHORTPRESS);
mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
@@ -9277,6 +9281,7 @@ public class WebView extends AbsoluteLayout
* @return True if the layer is successfully scrolled.
*/
private native boolean nativeScrollLayer(int layer, int newX, int newY);
private native void nativeSetIsScrolling(boolean isScrolling);
private native int nativeGetBackgroundColor();
native boolean nativeSetProperty(String key, String value);
native String nativeGetProperty(String key);

View File

@@ -2070,10 +2070,8 @@ public final class WebViewCore {
if (!core.getSettings().enableSmoothTransition()) return;
synchronized (core) {
core.nativeSetIsPaused(true);
core.mDrawIsPaused = true;
if (core.mDrawIsScheduled) {
core.mEventHub.removeMessages(EventHub.WEBKIT_DRAW);
}
}
}
@@ -2082,15 +2080,14 @@ public final class WebViewCore {
static void resumeUpdatePicture(WebViewCore core) {
if (core != null) {
// if mDrawIsPaused is true, ignore the setting, continue to resume
if (!core.mDrawIsPaused
&& !core.getSettings().enableSmoothTransition()) return;
if (!core.mDrawIsPaused)
return;
synchronized (core) {
core.nativeSetIsPaused(false);
core.mDrawIsPaused = false;
// always redraw on resume to reenable gif animations
core.mDrawIsScheduled = false;
core.nativeContentInvalidateAll();
core.contentDraw();
}
}
}
@@ -2127,7 +2124,6 @@ public final class WebViewCore {
// only fire an event if this is our first request
if (mDrawIsScheduled) return;
mDrawIsScheduled = true;
if (mDrawIsPaused) return;
mEventHub.sendMessage(Message.obtain(null, EventHub.WEBKIT_DRAW));
}
}
@@ -2789,6 +2785,7 @@ public final class WebViewCore {
return mDeviceOrientationService;
}
private native void nativeSetIsPaused(boolean isPaused);
private native void nativePause();
private native void nativeResume();
private native void nativeFreeMemory();