Skip to content

Commit cae80b2

Browse files
ChrisCraikAndroid (Google) Code Review
authored andcommitted
Merge "Unify composited layer/base layer draw path"
2 parents 0a1c6c8 + 00ed0fd commit cae80b2

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
@@ -9440,13 +9440,11 @@ private void updateHwAccelerated() {
94409440
&& mWebView.getLayerType() != View.LAYER_TYPE_SOFTWARE) {
94419441
hwAccelerated = true;
94429442
}
9443+
9444+
// result is of type LayerAndroid::InvalidateFlags, non zero means invalidate/redraw
94439445
int result = nativeSetHwAccelerated(mNativeClass, hwAccelerated);
9444-
if (mWebViewCore == null || mBlockWebkitViewMessages) {
9445-
return;
9446-
}
9447-
if (result == 1) {
9448-
// Sync layers
9449-
mWebViewCore.layersDraw();
9446+
if (mWebViewCore != null && !mBlockWebkitViewMessages && result != 0) {
9447+
mWebViewCore.contentDraw();
94509448
}
94519449
}
94529450

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.
@@ -2154,7 +2142,6 @@ void splitContent(int content) {
21542142

21552143
// Used to avoid posting more than one draw message.
21562144
private boolean mDrawIsScheduled;
2157-
private boolean mDrawLayersIsScheduled;
21582145

21592146
// Used to avoid posting more than one split picture message.
21602147
private boolean mSplitPictureIsScheduled;
@@ -2200,25 +2187,6 @@ static class DrawData {
22002187

22012188
DrawData mLastDrawData = null;
22022189

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

@@ -2394,15 +2362,6 @@ private void restoreState(int index) {
23942362
}
23952363
}
23962364

2397-
// called from JNI
2398-
void layersDraw() {
2399-
synchronized (this) {
2400-
if (mDrawLayersIsScheduled) return;
2401-
mDrawLayersIsScheduled = true;
2402-
mEventHub.sendMessage(Message.obtain(null, EventHub.WEBKIT_DRAW_LAYERS));
2403-
}
2404-
}
2405-
24062365
// called by JNI
24072366
private void contentScrollTo(int x, int y, boolean animate,
24082367
boolean onlyIfImeIsShowing) {

0 commit comments

Comments
 (0)