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

Unified Diff: android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java

Issue 1904453004: Transfer DrawGLFunctor ownership from AwContents to AwGLFunctor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java b/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
index 13e0fe20d24609e7ca453b938851c7f9d68833db..d03a662f2fe8f4f70a65b813740cd1770bc0766c 100644
--- a/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
@@ -35,7 +35,6 @@ import javax.microedition.khronos.opengles.GL10;
*/
public class AwTestContainerView extends FrameLayout {
private AwContents mAwContents;
- private AwContents.NativeGLDelegate mNativeGLDelegate;
private AwContents.InternalAccessDelegate mInternalAccessDelegate;
private HardwareView mHardwareView = null;
@@ -97,9 +96,9 @@ public class AwTestContainerView extends FrameLayout {
setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
}
- public void initialize(long drawGL, long viewContext) {
+ public void initialize(long drawGL) {
mDrawGL = drawGL;
- mViewContext = viewContext;
+ mViewContext = 0;
}
public boolean isReadyToRender() {
@@ -144,8 +143,10 @@ public class AwTestContainerView extends FrameLayout {
}
}
- public void requestRender(Canvas canvas, boolean waitForCompletion) {
+ public void requestRender(long viewContext, Canvas canvas, boolean waitForCompletion) {
synchronized (mSyncLock) {
+ assert mViewContext == 0 || mViewContext == viewContext;
+ mViewContext = viewContext;
super.requestRender();
mFunctorAttached = true;
mWaitForCompletion = waitForCompletion;
@@ -240,7 +241,6 @@ public class AwTestContainerView extends FrameLayout {
} else {
setLayerType(LAYER_TYPE_SOFTWARE, null);
}
- mNativeGLDelegate = new NativeGLDelegate();
mInternalAccessDelegate = new InternalAccessAdapter();
setOverScrollMode(View.OVER_SCROLL_ALWAYS);
setFocusable(true);
@@ -250,8 +250,7 @@ public class AwTestContainerView extends FrameLayout {
public void initialize(AwContents awContents) {
mAwContents = awContents;
if (isBackedByHardwareView()) {
- mHardwareView.initialize(
- AwContents.getAwDrawGLFunction(), mAwContents.getAwDrawGLViewContext());
+ mHardwareView.initialize(AwContents.getAwDrawGLFunction());
}
}
@@ -267,8 +266,8 @@ public class AwTestContainerView extends FrameLayout {
return mAwContents;
}
- public AwContents.NativeGLDelegate getNativeGLDelegate() {
- return mNativeGLDelegate;
+ public AwContents.NativeDrawGLFunctorFactory getNativeDrawGLFunctorFactory() {
+ return new NativeDrawGLFunctorFactory();
}
public AwContents.InternalAccessDelegate getInternalAccessDelegate() {
@@ -415,23 +414,41 @@ public class AwTestContainerView extends FrameLayout {
return mAwContents.performAccessibilityAction(action, arguments);
}
- private class NativeGLDelegate implements AwContents.NativeGLDelegate {
+ private class NativeDrawGLFunctorFactory implements AwContents.NativeDrawGLFunctorFactory {
+ public NativeDrawGLFunctor createFunctor(long context) {
+ return new NativeDrawGLFunctor(context);
+ }
+ }
+
+ private class NativeDrawGLFunctor implements AwContents.NativeDrawGLFunctor {
+ private long mContext;
+
+ NativeDrawGLFunctor(long context) {
+ mContext = context;
+ }
+
@Override
public boolean supportsDrawGLFunctorReleasedCallback() {
return false;
}
@Override
- public boolean requestDrawGL(Canvas canvas, boolean waitForCompletion, View containerview,
- Runnable releasedRunnable) {
+ public boolean requestDrawGL(Canvas canvas, Runnable releasedRunnable) {
assert releasedRunnable == null;
if (!isBackedByHardwareView()) return false;
- mHardwareView.requestRender(canvas, waitForCompletion);
+ mHardwareView.requestRender(mContext, canvas, false);
return true;
}
@Override
- public void detachGLFunctor() {
+ public boolean requestInvokeGL(View containerView, boolean waitForCompletion) {
+ if (!isBackedByHardwareView()) return false;
+ mHardwareView.requestRender(mContext, null, waitForCompletion);
+ return true;
+ }
+
+ @Override
+ public void detach(View containerView) {
if (isBackedByHardwareView()) mHardwareView.detachGLFunctor();
}
}
« no previous file with comments | « android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698