Skip to content

Commit 53913ed

Browse files
ChrisCraikAndroid (Google) Code Review
authored andcommitted
Merge "Force webview invalidates on unsuccessful functor attach" into jb-dev
2 parents f0e96de + 41ee465 commit 53913ed

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

core/java/android/view/HardwareRenderer.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,11 @@ abstract boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbac
457457
* @param functor The native functor to insert in the execution queue.
458458
*
459459
* @see HardwareCanvas#callDrawGLFunction(int)
460-
* @see #detachFunctor(int)
460+
* @see #detachFunctor(int)
461+
*
462+
* @return true if the functor was attached successfully
461463
*/
462-
abstract void attachFunctor(View.AttachInfo attachInfo, int functor);
464+
abstract boolean attachFunctor(View.AttachInfo attachInfo, int functor);
463465

464466
/**
465467
* Initializes the hardware renderer for the specified surface and setup the
@@ -1227,11 +1229,13 @@ void detachFunctor(int functor) {
12271229
}
12281230

12291231
@Override
1230-
void attachFunctor(View.AttachInfo attachInfo, int functor) {
1232+
boolean attachFunctor(View.AttachInfo attachInfo, int functor) {
12311233
if (mCanvas != null) {
12321234
mCanvas.attachFunctor(functor);
12331235
scheduleFunctors(attachInfo);
1236+
return true;
12341237
}
1238+
return false;
12351239
}
12361240

12371241
/**

core/java/android/view/ViewRootImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,10 +670,11 @@ void destroyHardwareLayers() {
670670
}
671671
}
672672

673-
public void attachFunctor(int functor) {
673+
public boolean attachFunctor(int functor) {
674674
if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
675-
mAttachInfo.mHardwareRenderer.attachFunctor(mAttachInfo, functor);
675+
return mAttachInfo.mHardwareRenderer.attachFunctor(mAttachInfo, functor);
676676
}
677+
return false;
677678
}
678679

679680
public void detachFunctor(int functor) {

core/java/android/webkit/WebViewClassic.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7827,15 +7827,18 @@ void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) {
78277827
mSendScrollEvent = true;
78287828

78297829
int functor = 0;
7830+
boolean forceInval = isPictureAfterFirstLayout;
78307831
ViewRootImpl viewRoot = mWebView.getViewRootImpl();
78317832
if (mWebView.isHardwareAccelerated() && viewRoot != null) {
78327833
functor = nativeGetDrawGLFunction(mNativeClass);
78337834
if (functor != 0) {
7834-
viewRoot.attachFunctor(functor);
7835+
// force an invalidate if functor attach not successful
7836+
forceInval |= !viewRoot.attachFunctor(functor);
78357837
}
78367838
}
78377839

78387840
if (functor == 0
7841+
|| forceInval
78397842
|| mWebView.getLayerType() != View.LAYER_TYPE_NONE) {
78407843
// invalidate the screen so that the next repaint will show new content
78417844
// TODO: partial invalidate

0 commit comments

Comments
 (0)