Chromium Code Reviews| Index: android_webview/java/src/org/chromium/android_webview/AwContents.java |
| diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java |
| index e932149ae1c0c578d7fba3208bc27f56fbbf0785..cec917d5f78ba4b98d8c10815604e6c23a2e7c0b 100644 |
| --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java |
| +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java |
| @@ -165,12 +165,22 @@ public class AwContents implements SmartClipProvider, |
| } |
| /** |
| + * Factory interface used for constructing functors that the Android framework uses for |
| + * calling back into Chromium code to render the the contents of a Chromium frame into |
| + * an Android view. |
| + */ |
| + public interface NativeDrawGLFunctorFactory { |
| + /** |
| + * Create a functor associated with native context |context|. |
| + */ |
| + NativeDrawGLFunctor createFunctor(long context); |
| + } |
| + |
| + /** |
| * Interface that consumers of {@link AwContents} must implement to support |
| * native GL rendering. |
| */ |
| - public interface NativeGLDelegate { |
| - boolean supportsDrawGLFunctorReleasedCallback(); |
| - |
| + public interface NativeDrawGLFunctor { |
| /** |
| * Requests a callback on the native DrawGL method (see getAwDrawGLFunction) |
| * if called from within onDraw, |canvas| will be non-null and hardware accelerated. |
| @@ -179,17 +189,32 @@ public class AwContents implements SmartClipProvider, |
| * functor has returned. |
| * Should avoid setting |waitForCompletion| when |canvas| is not null. |
| * |containerView| is the view where the AwContents should be drawn. |
| + * |releasedCallback| should be null if |canvas| is null, or if |
| + * supportsDrawglfunctorreleasedcallback returns false. |
| * |
| * @return false indicates the GL draw request was not accepted, and the caller |
| * should fallback to the SW path. |
| */ |
| - boolean requestDrawGL(Canvas canvas, boolean waitForCompletion, View containerView, |
| - Runnable releasedRunnable); |
| + boolean requestDrawGL(View containerView, Canvas canvas, Runnable releasedCallback); |
|
boliu
2016/04/20 15:38:32
this doesn't need container view, right?
Tobias Sargeant
2016/04/20 16:00:31
Contingent upon not needing the check, no, it does
|
| + |
| + /** |
| + * |
| + */ |
| + boolean requestDrawGL(View containerView, boolean waitForCompletion); |
|
Tobias Sargeant
2016/04/20 16:00:31
I considered that maybe this could be called reque
boliu
2016/04/20 16:02:23
sgtm
|
| + |
| + /** |
| + * Test whether the Android framework supports notifying when a functor is free |
| + * to be destroyed via the callback mechanism provided to the functor factory. |
| + * |
| + * @return true if destruction needs to wait on a framework callback, or false |
| + * if it can occur immediately. |
| + */ |
| + boolean supportsDrawGLFunctorReleasedCallback(); |
| /** |
| * Detaches the GLFunctor from the view tree. |
| */ |
| - void detachGLFunctor(); |
| + void detach(); |
| } |
| /** |
| @@ -239,7 +264,7 @@ public class AwContents implements SmartClipProvider, |
| private final AwContentsIoThreadClient mIoThreadClient; |
| private final InterceptNavigationDelegateImpl mInterceptNavigationDelegate; |
| private InternalAccessDelegate mInternalAccessAdapter; |
| - private final NativeGLDelegate mNativeGLDelegate; |
| + private final NativeDrawGLFunctorFactory mNativeDrawGLFunctorFactory; |
| private final AwLayoutSizer mLayoutSizer; |
| private final AwZoomControls mZoomControls; |
| private final AwScrollOffsetManager mScrollOffsetManager; |
| @@ -675,10 +700,11 @@ public class AwContents implements SmartClipProvider, |
| * This constructor uses the default view sizing policy. |
| */ |
| public AwContents(AwBrowserContext browserContext, ViewGroup containerView, Context context, |
| - InternalAccessDelegate internalAccessAdapter, NativeGLDelegate nativeGLDelegate, |
| - AwContentsClient contentsClient, AwSettings awSettings) { |
| - this(browserContext, containerView, context, internalAccessAdapter, nativeGLDelegate, |
| - contentsClient, awSettings, new DependencyFactory()); |
| + InternalAccessDelegate internalAccessAdapter, |
| + NativeDrawGLFunctorFactory nativeDrawGLFunctorFactory, AwContentsClient contentsClient, |
| + AwSettings awSettings) { |
| + this(browserContext, containerView, context, internalAccessAdapter, |
| + nativeDrawGLFunctorFactory, contentsClient, awSettings, new DependencyFactory()); |
| } |
| /** |
| @@ -689,9 +715,9 @@ public class AwContents implements SmartClipProvider, |
| * documented classes. |
| */ |
| public AwContents(AwBrowserContext browserContext, ViewGroup containerView, Context context, |
| - InternalAccessDelegate internalAccessAdapter, NativeGLDelegate nativeGLDelegate, |
| - AwContentsClient contentsClient, AwSettings settings, |
| - DependencyFactory dependencyFactory) { |
| + InternalAccessDelegate internalAccessAdapter, |
| + NativeDrawGLFunctorFactory nativeDrawGLFunctorFactory, AwContentsClient contentsClient, |
| + AwSettings settings, DependencyFactory dependencyFactory) { |
| setLocale(LocaleUtils.getDefaultLocale()); |
| settings.updateAcceptLanguages(); |
| @@ -707,7 +733,7 @@ public class AwContents implements SmartClipProvider, |
| mContext = context; |
| mAppTargetSdkVersion = mContext.getApplicationInfo().targetSdkVersion; |
| mInternalAccessAdapter = internalAccessAdapter; |
| - mNativeGLDelegate = nativeGLDelegate; |
| + mNativeDrawGLFunctorFactory = nativeDrawGLFunctorFactory; |
| mContentsClient = contentsClient; |
| mAwViewMethods = new AwViewMethodsImpl(); |
| mFullScreenTransitionsState = new FullScreenTransitionsState( |
| @@ -976,7 +1002,7 @@ public class AwContents implements SmartClipProvider, |
| mContentViewCore = createAndInitializeContentViewCore(mContainerView, mContext, |
| mInternalAccessAdapter, webContents, new AwGestureStateListener(), |
| mContentViewClient, mZoomControls, mWindowAndroid.getWindowAndroid()); |
| - mAwGLFunctor = new AwGLFunctor(mNativeGLDelegate, mContainerView); |
| + mAwGLFunctor = new AwGLFunctor(mNativeDrawGLFunctorFactory, mContainerView); |
| nativeSetAwGLFunctor(mNativeAwContents, mAwGLFunctor.getNativeAwGLFunctor()); |
| nativeSetJavaPeers(mNativeAwContents, this, mWebContentsDelegate, mContentsClientBridge, |
| mIoThreadClient, mInterceptNavigationDelegate); |