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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java

Issue 15871003: Fix callback after destruction of native ContentViewRenderView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java
index ddd6b28c44bf798835caff2945a5476646ba0c19..469c75622bb5fa223e9a1d8b4e6b290b8cdb7cb2 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java
@@ -23,6 +23,7 @@ public class ContentViewRenderView extends FrameLayout {
// The native side of this object.
private int mNativeContentViewRenderView = 0;
+ private final SurfaceHolder.Callback mSurfaceCallback;
private SurfaceView mSurfaceView;
private VSyncAdapter mVSyncAdapter;
@@ -41,9 +42,10 @@ public class ContentViewRenderView extends FrameLayout {
assert mNativeContentViewRenderView != 0;
mSurfaceView = createSurfaceView(getContext());
- mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
+ mSurfaceCallback = new SurfaceHolder.Callback() {
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+ assert mNativeContentViewRenderView != 0;
nativeSurfaceSetSize(mNativeContentViewRenderView, width, height);
if (mCurrentContentView != null) {
mCurrentContentView.getContentViewCore().onPhysicalBackingSizeChanged(
@@ -53,15 +55,18 @@ public class ContentViewRenderView extends FrameLayout {
@Override
public void surfaceCreated(SurfaceHolder holder) {
+ assert mNativeContentViewRenderView != 0;
nativeSurfaceCreated(mNativeContentViewRenderView, holder.getSurface());
onReadyToRender();
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
+ assert mNativeContentViewRenderView != 0;
nativeSurfaceDestroyed(mNativeContentViewRenderView);
}
- });
+ };
+ mSurfaceView.getHolder().addCallback(mSurfaceCallback);
mVSyncAdapter = new VSyncAdapter(getContext());
addView(mSurfaceView,
@@ -124,13 +129,16 @@ public class ContentViewRenderView extends FrameLayout {
* native resource can be freed.
*/
public void destroy() {
+ mSurfaceView.getHolder().removeCallback(mSurfaceCallback);
nativeDestroy(mNativeContentViewRenderView);
+ mNativeContentViewRenderView = 0;
}
/**
* Makes the passed ContentView the one displayed by this ContentViewRenderView.
*/
public void setCurrentContentView(ContentView contentView) {
+ assert mNativeContentViewRenderView != 0;
ContentViewCore contentViewCore = contentView.getContentViewCore();
nativeSetCurrentContentView(mNativeContentViewRenderView,
contentViewCore.getNativeContentViewCore());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698