Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
[Android] Only initialize ContentReadbackHandler in onNativeLibraryLo…
Browse files Browse the repository at this point in the history
…aded for TextureView.

Let's bail out after ContentReadbackHandler initialization in the case of
TextureView.

BUG=https://crosswalk-project.org/jira/browse/XWALK-1887

Reworked with M38.
  • Loading branch information
Hongbo Min authored and Raphael Kubo da Costa committed Jun 23, 2015
1 parent 6ca7170 commit cb52329
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,23 @@ public ContentViewRenderView(Context context, CompositingSurfaceType surfaceType
* @param rootWindow The {@link WindowAndroid} this render view should be linked to.
*/
public void onNativeLibraryLoaded(WindowAndroid rootWindow) {
assert !mSurfaceView.getHolder().getSurface().isValid() :
"Surface created before native library loaded.";
assert rootWindow != null;
mNativeContentViewRenderView = nativeInit(rootWindow.getNativePointer());
assert mNativeContentViewRenderView != 0;

mContentReadbackHandler = new ContentReadbackHandler() {
@Override
protected boolean readyForReadback() {
return mNativeContentViewRenderView != 0 && mContentViewCore != null;
}
};
mContentReadbackHandler.initNativeContentReadbackHandler();

if (mCompositingSurfaceType == CompositingSurfaceType.TEXTURE_VIEW)
return;

assert !mSurfaceView.getHolder().getSurface().isValid() :
"Surface created before native library loaded.";
mSurfaceCallback = new SurfaceHolder.Callback() {
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Expand Down Expand Up @@ -206,14 +218,6 @@ public void surfaceDestroyed(SurfaceHolder holder) {
};
mSurfaceView.getHolder().addCallback(mSurfaceCallback);
mSurfaceView.setVisibility(VISIBLE);

mContentReadbackHandler = new ContentReadbackHandler() {
@Override
protected boolean readyForReadback() {
return mNativeContentViewRenderView != 0 && mContentViewCore != null;
}
};
mContentReadbackHandler.initNativeContentReadbackHandler();
}

/**
Expand Down

0 comments on commit cb52329

Please sign in to comment.