Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / content / public / android / java / src / org / chromium / content / browser / ContentViewRenderView.java
index 6c4a61b..be8e525 100644 (file)
@@ -173,11 +173,23 @@ public class ContentViewRenderView extends FrameLayout {
      * @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) {
@@ -204,19 +216,8 @@ public class ContentViewRenderView extends FrameLayout {
                 nativeSurfaceDestroyed(mNativeContentViewRenderView);
             }
         };
-
-        if (mCompositingSurfaceType == CompositingSurfaceType.SURFACE_VIEW) {
-            mSurfaceView.getHolder().addCallback(mSurfaceCallback);
-            mSurfaceView.setVisibility(VISIBLE);
-        }
-
-        mContentReadbackHandler = new ContentReadbackHandler() {
-            @Override
-            protected boolean readyForReadback() {
-                return mNativeContentViewRenderView != 0 && mContentViewCore != null;
-            }
-        };
-        mContentReadbackHandler.initNativeContentReadbackHandler();
+        mSurfaceView.getHolder().addCallback(mSurfaceCallback);
+        mSurfaceView.setVisibility(VISIBLE);
     }
 
     /**
@@ -254,7 +255,6 @@ public class ContentViewRenderView extends FrameLayout {
         } else {
             mSurfaceView.getHolder().removeCallback(mSurfaceCallback);
         }
-
         nativeDestroy(mNativeContentViewRenderView);
         mNativeContentViewRenderView = 0;
     }
@@ -312,7 +312,6 @@ public class ContentViewRenderView extends FrameLayout {
             nativeSetOverlayVideoMode(mNativeContentViewRenderView, enabled);
             return;
         }
-
         int format = enabled ? PixelFormat.TRANSLUCENT : PixelFormat.OPAQUE;
         mSurfaceView.getHolder().setFormat(format);
         nativeSetOverlayVideoMode(mNativeContentViewRenderView, enabled);