Skip to content

Commit a75fbc3

Browse files
jreckAndroid (Google) Code Review
authored andcommitted
Merge "On new content, attach functor directly" into jb-dev
2 parents 8597321 + c2c9543 commit a75fbc3

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
@@ -2669,7 +2669,7 @@ public boolean pageDown(boolean bottom) {
26692669
public void clearView() {
26702670
mContentWidth = 0;
26712671
mContentHeight = 0;
2672-
setBaseLayer(0, null, false, false);
2672+
setBaseLayer(0, false, false);
26732673
mWebViewCore.sendMessage(EventHub.CLEAR_CONTENT);
26742674
}
26752675

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

4451-
void setBaseLayer(int layer, Region invalRegion, boolean showVisualIndicator,
4451+
void setBaseLayer(int layer, boolean showVisualIndicator,
44524452
boolean isPictureAfterFirstLayout) {
44534453
if (mNativeClass == 0)
44544454
return;
44554455
boolean queueFull;
4456-
queueFull = nativeSetBaseLayer(mNativeClass, layer, invalRegion,
4456+
queueFull = nativeSetBaseLayer(mNativeClass, layer,
44574457
showVisualIndicator, isPictureAfterFirstLayout);
44584458

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

78507850
if (updateBaseLayer) {
7851-
setBaseLayer(draw.mBaseLayer, draw.mInvalRegion,
7851+
setBaseLayer(draw.mBaseLayer,
78527852
getSettings().getShowVisualIndicator(),
78537853
isPictureAfterFirstLayout);
78547854
}
@@ -7880,15 +7880,17 @@ void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) {
78807880
}
78817881
mSendScrollEvent = true;
78827882

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

@@ -8576,8 +8578,7 @@ private native void nativeUpdateDrawGLFunction(int nativeInstance, Rect rect
85768578
private native Rect nativeLayerBounds(int layer);
85778579
private native void nativeSetHeightCanMeasure(boolean measure);
85788580
private native boolean nativeSetBaseLayer(int nativeInstance,
8579-
int layer, Region invalRegion,
8580-
boolean showVisualIndicator, boolean isPictureAfterFirstLayout);
8581+
int layer, boolean showVisualIndicator, boolean isPictureAfterFirstLayout);
85818582
private native int nativeGetBaseLayer();
85828583
private native void nativeReplaceBaseContent(int content);
85838584
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)