Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 1885103002: [Merge M51] aw: Quick workaround for functor detach crash/hang (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/browser/render_thread_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 03752d9151f890ae0d667bc595e5447e52d94510..6c350aef581da8f80188af28408a39719a3ccc7d 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -252,6 +252,8 @@ public class AwContents implements SmartClipProvider,
// This can be accessed on any thread after construction. See AwContentsIoThreadClient.
private final AwSettings mSettings;
private final ScrollAccessibilityHelper mScrollAccessibilityHelper;
+ private final boolean mSupportsFunctorDetachedCallback;
+ private boolean mFunctorDetachedCallbackPending;
private boolean mIsPaused;
private boolean mIsViewVisible;
@@ -763,6 +765,13 @@ public class AwContents implements SmartClipProvider,
setNewAwContents(nativeInit(mBrowserContext));
+ mSupportsFunctorDetachedCallback =
+ mNativeGLDelegate.setDrawGLFunctionDetachedCallback(mContainerView, new Runnable() {
+ @Override
+ public void run() {
+ onFunctorDetached();
+ }
+ });
onContainerViewChanged();
}
@@ -1133,8 +1142,10 @@ public class AwContents implements SmartClipProvider,
mCleanupReference.cleanupNow();
mCleanupReference = null;
- mAwGLFunctor.destroy();
- mAwGLFunctor = null;
+ if (!mFunctorDetachedCallbackPending) {
+ mAwGLFunctor.destroy();
+ mAwGLFunctor = null;
+ }
}
assert mContentViewCore == null;
@@ -2333,6 +2344,16 @@ public class AwContents implements SmartClipProvider,
mAwViewMethods.onDetachedFromWindow();
}
+ // Note short term fix. This is only called for the original container view, not the
+ // FullScreenView.
+ public void onFunctorDetached() {
+ mFunctorDetachedCallbackPending = false;
+ if (isDestroyed(NO_WARN) && mAwGLFunctor != null) {
+ mAwGLFunctor.destroy();
+ mAwGLFunctor = null;
+ }
+ }
+
/**
* @see android.view.View#onWindowFocusChanged()
*/
@@ -2928,6 +2949,8 @@ public class AwContents implements SmartClipProvider,
globalVisibleRect.top, globalVisibleRect.right, globalVisibleRect.bottom);
if (did_draw && canvas.isHardwareAccelerated() && !FORCE_AUXILIARY_BITMAP_RENDERING) {
did_draw = mNativeGLDelegate.requestDrawGL(canvas, false, mContainerView);
+ mFunctorDetachedCallbackPending |=
+ (mSupportsFunctorDetachedCallback && did_draw && !isFullScreen());
}
if (did_draw) {
int scrollXDiff = mContainerView.getScrollX() - scrollX;
@@ -3096,7 +3119,6 @@ public class AwContents implements SmartClipProvider,
}
mIsAttachedToWindow = false;
hideAutofillPopup();
- mAwGLFunctor.deleteHardwareRenderer();
mAwGLFunctor.onDetachedFromWindow();
nativeOnDetachedFromWindow(mNativeAwContents);
« no previous file with comments | « android_webview/browser/render_thread_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698