summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Roard <nicolasroard@google.com> 2011-10-04 17:57:59 -0700
committer Nicolas Roard <nicolasroard@google.com> 2011-10-04 17:57:59 -0700
commitdc221e01ff25ecf404ed945e1899be1e03a5462f (patch)
treed8974e0e08bf3c2b89c6816619972961937cbf9a
parente0ef70abf56a02d9d6bf31f4f09c62ae69a94c9f (diff)
Streamline the layers update codepath.
Directly update the layers transform and position. This makes updates faster and less dependent on other webkit work. bug:5218173 Change-Id: I5f784ef64eda1be3cee406aa23702e5378c8de9e
-rw-r--r--core/java/android/webkit/WebViewCore.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 63c4d032ddab..440ee79aa0fd 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -518,7 +518,7 @@ public final class WebViewCore {
/**
* Update the layers' content
*/
- private native int nativeUpdateLayers(Region invalRegion);
+ private native boolean nativeUpdateLayers(int baseLayer);
private native boolean nativeFocusBoundsChanged();
@@ -2004,18 +2004,25 @@ public final class WebViewCore {
boolean mFocusSizeChanged;
}
+ DrawData mLastDrawData = null;
+
// Only update the layers' content, not the base surface
// PictureSet.
private void webkitDrawLayers() {
mDrawLayersIsScheduled = false;
- if (mDrawIsScheduled) {
+ if (mDrawIsScheduled || mLastDrawData == null) {
removeMessages(EventHub.WEBKIT_DRAW);
webkitDraw();
return;
}
- DrawData draw = new DrawData();
- draw.mBaseLayer = nativeUpdateLayers(draw.mInvalRegion);
- webkitDraw(draw);
+ // Directly update the layers we last passed to the UI side
+ if (nativeUpdateLayers(mLastDrawData.mBaseLayer)) {
+ // 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() {
@@ -2032,6 +2039,7 @@ public final class WebViewCore {
}
return;
}
+ mLastDrawData = draw;
webkitDraw(draw);
}