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

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

Issue 92603002: android: Fix black screen at startng frame when using ContentViewRenderView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 7 years 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 0ecee71b94aa7a52280e0ee4dfcac6dd6c570379..5e0bb3ebf3c1a281582fa165dd6ec55742937450 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
@@ -60,8 +60,6 @@ public class ContentViewRenderView extends FrameLayout {
mNativeContentViewRenderView = nativeInit(rootWindow.getNativePointer());
assert mNativeContentViewRenderView != 0;
- setBackgroundColor(Color.WHITE);
-
mSurfaceView = createSurfaceView(getContext());
mSurfaceCallback = new SurfaceHolder.Callback() {
@Override
@@ -88,6 +86,7 @@ public class ContentViewRenderView extends FrameLayout {
}
};
mSurfaceView.getHolder().addCallback(mSurfaceCallback);
+ setSurfaceViewBackgroundColor(Color.WHITE);
mVSyncAdapter = new VSyncAdapter(getContext());
addView(mSurfaceView,
@@ -161,6 +160,18 @@ public class ContentViewRenderView extends FrameLayout {
}
/**
+ * Sets the background color of the surface view. This method is necessary because the
+ * background color of ContentViewRenderView itself is covered by the background of
+ * SurfaceView.
+ * @param color The color of the background.
+ */
+ public void setSurfaceViewBackgroundColor(int color) {
+ if (mSurfaceView != null) {
+ mSurfaceView.setBackgroundColor(color);
+ }
+ }
+
+ /**
* Should be called when the ContentViewRenderView is not needed anymore so its associated
* native resource can be freed.
*/
@@ -279,11 +290,11 @@ public class ContentViewRenderView extends FrameLayout {
boolean didDraw = nativeComposite(mNativeContentViewRenderView);
if (didDraw) {
mPendingSwapBuffers++;
- if (getBackground() != null) {
+ if (mSurfaceView.getBackground() != null) {
post(new Runnable() {
@Override
public void run() {
- setBackgroundResource(0);
+ mSurfaceView.setBackgroundResource(0);
}
});
}
« 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