Skip to content

Commit c2c9543

Browse files
committed
On new content, attach functor directly
bug:6323847 depends on external/webkit change: https://android-git.corp.google.com/g/#/c/184314/ Change-Id: Ibdf997f3ee4f5c5c1ea5a320556813f175fea93f
1 parent 7725180 commit c2c9543

File tree

4 files changed

+21
-26
lines changed

4 files changed

+21
-26
lines changed

core/java/android/webkit/ViewStateSerializer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ static DrawData deserializeViewState(InputStream stream)
6464
draw.mViewState = new WebViewCore.ViewState();
6565
draw.mContentSize = new Point(contentWidth, contentHeight);
6666
draw.mBaseLayer = baseLayer;
67-
draw.mInvalRegion = new Region(0, 0, contentWidth, contentHeight);
6867
stream.close();
6968
return draw;
7069
}

core/java/android/webkit/WebViewClassic.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,7 +2668,7 @@ public boolean pageDown(boolean bottom) {
26682668
public void clearView() {
26692669
mContentWidth = 0;
26702670
mContentHeight = 0;
2671-
setBaseLayer(0, null, false, false);
2671+
setBaseLayer(0, false, false);
26722672
mWebViewCore.sendMessage(EventHub.CLEAR_CONTENT);
26732673
}
26742674

@@ -4447,12 +4447,12 @@ public void onConfigurationChanged(Configuration newConfig) {
44474447
*/
44484448
private SelectActionModeCallback mSelectCallback;
44494449

4450-
void setBaseLayer(int layer, Region invalRegion, boolean showVisualIndicator,
4450+
void setBaseLayer(int layer, boolean showVisualIndicator,
44514451
boolean isPictureAfterFirstLayout) {
44524452
if (mNativeClass == 0)
44534453
return;
44544454
boolean queueFull;
4455-
queueFull = nativeSetBaseLayer(mNativeClass, layer, invalRegion,
4455+
queueFull = nativeSetBaseLayer(mNativeClass, layer,
44564456
showVisualIndicator, isPictureAfterFirstLayout);
44574457

44584458
if (queueFull) {
@@ -7847,7 +7847,7 @@ void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) {
78477847
boolean isPictureAfterFirstLayout = viewState != null;
78487848

78497849
if (updateBaseLayer) {
7850-
setBaseLayer(draw.mBaseLayer, draw.mInvalRegion,
7850+
setBaseLayer(draw.mBaseLayer,
78517851
getSettings().getShowVisualIndicator(),
78527852
isPictureAfterFirstLayout);
78537853
}
@@ -7879,15 +7879,17 @@ void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) {
78797879
}
78807880
mSendScrollEvent = true;
78817881

7882-
if (DebugFlags.WEB_VIEW) {
7883-
Rect b = draw.mInvalRegion.getBounds();
7884-
Log.v(LOGTAG, "NEW_PICTURE_MSG_ID {" +
7885-
b.left+","+b.top+","+b.right+","+b.bottom+"}");
7882+
int functor = 0;
7883+
if (mWebView.isHardwareAccelerated()
7884+
|| mWebView.getLayerType() != View.LAYER_TYPE_HARDWARE) {
7885+
functor = nativeGetDrawGLFunction(mNativeClass);
78867886
}
7887-
Rect invalBounds = draw.mInvalRegion.getBounds();
7888-
if (!invalBounds.isEmpty()) {
7889-
invalidateContentRect(invalBounds);
7887+
7888+
if (functor != 0) {
7889+
mWebView.getViewRootImpl().attachFunctor(functor);
78907890
} else {
7891+
// invalidate the screen so that the next repaint will show new content
7892+
// TODO: partial invalidate
78917893
mWebView.invalidate();
78927894
}
78937895

@@ -8575,8 +8577,7 @@ private native void nativeUpdateDrawGLFunction(int nativeInstance, Rect rect
85758577
private native Rect nativeLayerBounds(int layer);
85768578
private native void nativeSetHeightCanMeasure(boolean measure);
85778579
private native boolean nativeSetBaseLayer(int nativeInstance,
8578-
int layer, Region invalRegion,
8579-
boolean showVisualIndicator, boolean isPictureAfterFirstLayout);
8580+
int layer, boolean showVisualIndicator, boolean isPictureAfterFirstLayout);
85808581
private native int nativeGetBaseLayer();
85818582
private native void nativeReplaceBaseContent(int content);
85828583
private native void nativeCopyBaseContentToPicture(Picture pict);

core/java/android/webkit/WebViewCore.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,7 @@ protected void exitFullscreenVideo() {
601601
* Redraw a portion of the picture set. The Point wh returns the
602602
* width and height of the overall picture.
603603
*/
604-
private native int nativeRecordContent(int nativeClass, Region invalRegion,
605-
Point wh);
604+
private native int nativeRecordContent(int nativeClass, Point wh);
606605

607606
/**
608607
* Notify webkit that animations have begun (on the hardware accelerated content)
@@ -2180,11 +2179,9 @@ static class ViewState {
21802179
static class DrawData {
21812180
DrawData() {
21822181
mBaseLayer = 0;
2183-
mInvalRegion = new Region();
21842182
mContentSize = new Point();
21852183
}
21862184
int mBaseLayer;
2187-
Region mInvalRegion;
21882185
// view size that was used by webkit during the most recent layout
21892186
Point mViewSize;
21902187
Point mContentSize;
@@ -2230,8 +2227,7 @@ private void webkitDraw() {
22302227
mDrawIsScheduled = false;
22312228
DrawData draw = new DrawData();
22322229
if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw start");
2233-
draw.mBaseLayer = nativeRecordContent(mNativeClass, draw.mInvalRegion,
2234-
draw.mContentSize);
2230+
draw.mBaseLayer = nativeRecordContent(mNativeClass, draw.mContentSize);
22352231
if (draw.mBaseLayer == 0) {
22362232
if (mWebViewClassic != null && !mWebViewClassic.isPaused()) {
22372233
if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw abort, resending draw message");
@@ -2277,8 +2273,7 @@ private void saveViewState(OutputStream stream,
22772273
// the draw path (and fix saving <canvas>)
22782274
DrawData draw = new DrawData();
22792275
if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "saveViewState start");
2280-
draw.mBaseLayer = nativeRecordContent(mNativeClass, draw.mInvalRegion,
2281-
draw.mContentSize);
2276+
draw.mBaseLayer = nativeRecordContent(mNativeClass, draw.mContentSize);
22822277
boolean result = false;
22832278
try {
22842279
result = ViewStateSerializer.serializeViewState(stream, draw);

libs/hwui/OpenGLRenderer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,13 @@ status_t OpenGLRenderer::invokeFunctors(Rect& dirty) {
267267
Functor* f = functors.itemAt(i);
268268
result |= (*f)(DrawGlInfo::kModeProcess, &info);
269269

270-
if (result != DrawGlInfo::kStatusDone) {
270+
if (result & DrawGlInfo::kStatusDraw) {
271271
Rect localDirty(info.dirtyLeft, info.dirtyTop, info.dirtyRight, info.dirtyBottom);
272272
dirty.unionWith(localDirty);
273+
}
273274

274-
if (result & DrawGlInfo::kStatusInvoke) {
275-
mFunctors.add(f);
276-
}
275+
if (result & DrawGlInfo::kStatusInvoke) {
276+
mFunctors.add(f);
277277
}
278278
}
279279
}

0 commit comments

Comments
 (0)