Merge "Streamline the layers update codepath. Directly update the layers transform and position. This makes updates faster and less dependent on other webkit work."

This commit is contained in:
Nicolas Roard
2011-10-05 11:35:29 -07:00
committed by Android (Google) Code Review

View File

@@ -518,7 +518,7 @@ public final class WebViewCore {
/** /**
* Update the layers' content * Update the layers' content
*/ */
private native int nativeUpdateLayers(Region invalRegion); private native boolean nativeUpdateLayers(int baseLayer);
private native boolean nativeFocusBoundsChanged(); private native boolean nativeFocusBoundsChanged();
@@ -2004,18 +2004,25 @@ public final class WebViewCore {
boolean mFocusSizeChanged; boolean mFocusSizeChanged;
} }
DrawData mLastDrawData = null;
// Only update the layers' content, not the base surface // Only update the layers' content, not the base surface
// PictureSet. // PictureSet.
private void webkitDrawLayers() { private void webkitDrawLayers() {
mDrawLayersIsScheduled = false; mDrawLayersIsScheduled = false;
if (mDrawIsScheduled) { if (mDrawIsScheduled || mLastDrawData == null) {
removeMessages(EventHub.WEBKIT_DRAW); removeMessages(EventHub.WEBKIT_DRAW);
webkitDraw(); webkitDraw();
return; return;
} }
DrawData draw = new DrawData(); // Directly update the layers we last passed to the UI side
draw.mBaseLayer = nativeUpdateLayers(draw.mInvalRegion); if (nativeUpdateLayers(mLastDrawData.mBaseLayer)) {
webkitDraw(draw); // If anything more complex than position has been touched, let's do a full draw
webkitDraw();
} else {
Message.obtain(mWebView.mPrivateHandler,
WebView.INVAL_RECT_MSG_ID).sendToTarget();
}
} }
private void webkitDraw() { private void webkitDraw() {
@@ -2032,6 +2039,7 @@ public final class WebViewCore {
} }
return; return;
} }
mLastDrawData = draw;
webkitDraw(draw); webkitDraw(draw);
} }