Skip to content

Commit 00ed0fd

Browse files
committed
Unify composited layer/base layer draw path
Multiple paths were redundant, as they both synchronized the layers, and drew the base if needed. Depends on external/webkit change: https://android-git.corp.google.com/g/#/c/179965/ Change-Id: I1c355510f6edda4631190f2d26df8171e795a6ac
1 parent 7405b90 commit 00ed0fd

File tree

2 files changed

+4
-47
lines changed

2 files changed

+4
-47
lines changed

core/java/android/webkit/WebViewClassic.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9417,13 +9417,11 @@ private void updateHwAccelerated() {
94179417
&& mWebView.getLayerType() != View.LAYER_TYPE_SOFTWARE) {
94189418
hwAccelerated = true;
94199419
}
9420+
9421+
// result is of type LayerAndroid::InvalidateFlags, non zero means invalidate/redraw
94209422
int result = nativeSetHwAccelerated(mNativeClass, hwAccelerated);
9421-
if (mWebViewCore == null || mBlockWebkitViewMessages) {
9422-
return;
9423-
}
9424-
if (result == 1) {
9425-
// Sync layers
9426-
mWebViewCore.layersDraw();
9423+
if (mWebViewCore != null && !mBlockWebkitViewMessages && result != 0) {
9424+
mWebViewCore.contentDraw();
94279425
}
94289426
}
94299427

core/java/android/webkit/WebViewCore.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -594,11 +594,6 @@ protected void exitFullscreenVideo() {
594594
private native int nativeRecordContent(int nativeClass, Region invalRegion,
595595
Point wh);
596596

597-
/**
598-
* Update the layers' content
599-
*/
600-
private native boolean nativeUpdateLayers(int nativeClass, int baseLayer);
601-
602597
/**
603598
* Notify webkit that animations have begun (on the hardware accelerated content)
604599
*/
@@ -1115,9 +1110,6 @@ public class EventHub {
11151110
// Load and save web archives
11161111
static final int SAVE_WEBARCHIVE = 147;
11171112

1118-
// Update layers
1119-
static final int WEBKIT_DRAW_LAYERS = 148;
1120-
11211113
static final int REMOVE_JS_INTERFACE = 149;
11221114

11231115
// Network-based messaging
@@ -1266,10 +1258,6 @@ public void handleMessage(Message msg) {
12661258
webkitDraw();
12671259
break;
12681260

1269-
case WEBKIT_DRAW_LAYERS:
1270-
webkitDrawLayers();
1271-
break;
1272-
12731261
case DESTROY:
12741262
// Time to take down the world. Cancel all pending
12751263
// loads and destroy the native view and frame.
@@ -2148,7 +2136,6 @@ void splitContent(int content) {
21482136

21492137
// Used to avoid posting more than one draw message.
21502138
private boolean mDrawIsScheduled;
2151-
private boolean mDrawLayersIsScheduled;
21522139

21532140
// Used to avoid posting more than one split picture message.
21542141
private boolean mSplitPictureIsScheduled;
@@ -2194,25 +2181,6 @@ static class DrawData {
21942181

21952182
DrawData mLastDrawData = null;
21962183

2197-
// Only update the layers' content, not the base surface
2198-
// PictureSet.
2199-
private void webkitDrawLayers() {
2200-
mDrawLayersIsScheduled = false;
2201-
if (mDrawIsScheduled || mLastDrawData == null) {
2202-
removeMessages(EventHub.WEBKIT_DRAW);
2203-
webkitDraw();
2204-
return;
2205-
}
2206-
// Directly update the layers we last passed to the UI side
2207-
if (nativeUpdateLayers(mNativeClass, mLastDrawData.mBaseLayer)) {
2208-
// If anything more complex than position has been touched, let's do a full draw
2209-
webkitDraw();
2210-
}
2211-
mWebViewClassic.mPrivateHandler.removeMessages(WebViewClassic.INVAL_RECT_MSG_ID);
2212-
mWebViewClassic.mPrivateHandler.sendMessageAtFrontOfQueue(mWebViewClassic.mPrivateHandler
2213-
.obtainMessage(WebViewClassic.INVAL_RECT_MSG_ID));
2214-
}
2215-
22162184
private Boolean m_skipDrawFlag = false;
22172185
private boolean m_drawWasSkipped = false;
22182186

@@ -2388,15 +2356,6 @@ private void restoreState(int index) {
23882356
}
23892357
}
23902358

2391-
// called from JNI
2392-
void layersDraw() {
2393-
synchronized (this) {
2394-
if (mDrawLayersIsScheduled) return;
2395-
mDrawLayersIsScheduled = true;
2396-
mEventHub.sendMessage(Message.obtain(null, EventHub.WEBKIT_DRAW_LAYERS));
2397-
}
2398-
}
2399-
24002359
// called by JNI
24012360
private void contentScrollTo(int x, int y, boolean animate,
24022361
boolean onlyIfImeIsShowing) {

0 commit comments

Comments
 (0)