zoomScale = mZoomScale;
// set mZoomScale to be 0 as we have done animation
mZoomScale = 0;
+ WebViewCore.resumeUpdatePicture(mWebViewCore);
// call invalidate() again to draw with the final filters
invalidate();
if (mNeedToAdjustWebTextView) {
deltaX = 0;
deltaY = 0;
- WebViewCore.reducePriority(mWebViewCore);
+ WebViewCore.reducePriority();
if (!mDragFromTextInput) {
nativeHideCursor();
}
|| computeVerticalScrollExtent() < computeVerticalScrollRange())) {
// we will not rewrite drag code here, but we
// will try fling if it applies.
- WebViewCore.reducePriority(mWebViewCore);
+ WebViewCore.reducePriority();
// fall through to TOUCH_DRAG_MODE
} else {
break;
break;
}
mLastVelocity = 0;
- WebViewCore.resumePriority(mWebViewCore);
+ WebViewCore.resumePriority();
break;
case TOUCH_DRAG_START_MODE:
case TOUCH_DONE_MODE:
mVelocityTracker = null;
}
if (mTouchMode == TOUCH_DRAG_MODE) {
- WebViewCore.resumePriority(mWebViewCore);
+ WebViewCore.resumePriority();
}
mPrivateHandler.removeMessages(SWITCH_TO_SHORTPRESS);
mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
vy = vy * 3 / 4;
}
if ((maxX == 0 && vy == 0) || (maxY == 0 && vx == 0)) {
- WebViewCore.resumePriority(mWebViewCore);
+ WebViewCore.resumePriority();
return;
}
float currentVelocity = mScroller.getCurrVelocity();
mInvInitialZoomScale = 1.0f / oldScale;
mInvFinalZoomScale = 1.0f / mActualScale;
mZoomScale = mActualScale;
+ WebViewCore.pauseUpdatePicture(mWebViewCore);
invalidate();
return true;
} else {
}
break;
case RESUME_WEBCORE_PRIORITY:
- WebViewCore.resumePriority(mWebViewCore);
+ WebViewCore.resumePriority();
break;
case LONG_PRESS_CENTER:
// Used to avoid posting more than one split picture message.
private boolean mSplitPictureIsScheduled;
+ // Used to suspend drawing.
+ private boolean mDrawIsPaused;
+
// mRestoreState is set in didFirstLayout(), and reset in the next
// webkitDraw after passing it to the UI thread.
private RestoreState mRestoreState = null;
return result;
}
- static void reducePriority(WebViewCore core) {
+ static void reducePriority() {
// remove the pending REDUCE_PRIORITY and RESUME_PRIORITY messages
sWebCoreHandler.removeMessages(WebCoreThread.REDUCE_PRIORITY);
sWebCoreHandler.removeMessages(WebCoreThread.RESUME_PRIORITY);
.obtainMessage(WebCoreThread.REDUCE_PRIORITY));
}
- static void resumePriority(WebViewCore core) {
+ static void resumePriority() {
// remove the pending REDUCE_PRIORITY and RESUME_PRIORITY messages
sWebCoreHandler.removeMessages(WebCoreThread.REDUCE_PRIORITY);
sWebCoreHandler.removeMessages(WebCoreThread.RESUME_PRIORITY);
.obtainMessage(WebCoreThread.BLOCK_CACHE_TICKER));
}
+ static void pauseUpdatePicture(WebViewCore core) {
+ // Note: there is one possible failure mode. If pauseUpdatePicture() is
+ // called from UI thread while WEBKIT_DRAW is just pulled out of the
+ // queue in WebCore thread to be executed. Then update won't be blocked.
+ if (core != null) {
+ synchronized (core) {
+ core.mDrawIsPaused = true;
+ if (core.mDrawIsScheduled) {
+ core.mEventHub.removeMessages(EventHub.WEBKIT_DRAW);
+ }
+ }
+ }
+
+ }
+
+ static void resumeUpdatePicture(WebViewCore core) {
+ if (core != null) {
+ synchronized (core) {
+ core.mDrawIsPaused = false;
+ if (core.mDrawIsScheduled) {
+ core.mDrawIsScheduled = false;
+ core.contentDraw();
+ }
+ }
+ }
+ }
+
//////////////////////////////////////////////////////////////////////////
private void restoreState(int index) {
synchronized (this) {
if (mDrawIsScheduled) return;
mDrawIsScheduled = true;
+ if (mDrawIsPaused) return;
mEventHub.sendMessage(Message.obtain(null, EventHub.WEBKIT_DRAW));
}
}