FileDocCategorySizeDatePackage
DrawGLFunctor.javaAPI DocAndroid 5.1 API4823Thu Mar 12 22:22:56 GMT 2015com.android.webview.chromium

DrawGLFunctor

public class DrawGLFunctor extends Object

Fields Summary
private static final String
TAG
private org.chromium.content.common.CleanupReference
mCleanupReference
private DestroyRunnable
mDestroyRunnable
private com.android.webview.chromium.WebViewDelegateFactory.WebViewDelegate
mWebViewDelegate
Constructors Summary
public DrawGLFunctor(long viewContext, com.android.webview.chromium.WebViewDelegateFactory.WebViewDelegate webViewDelegate)


         
        mDestroyRunnable = new DestroyRunnable(nativeCreateGLFunctor(viewContext), webViewDelegate);
        mCleanupReference = new CleanupReference(this, mDestroyRunnable);
        mWebViewDelegate = webViewDelegate;
    
Methods Summary
public voiddestroy()

        detach();
        if (mCleanupReference != null) {
            mCleanupReference.cleanupNow();
            mCleanupReference = null;
            mDestroyRunnable = null;
            mWebViewDelegate = null;
        }
    
public voiddetach()

        mDestroyRunnable.detachNativeFunctor();
    
private static native longnativeCreateGLFunctor(long viewContext)

private static native voidnativeDestroyGLFunctor(long functor)

private static native voidnativeSetChromiumAwDrawGLFunction(long functionPointer)

public booleanrequestDrawGL(android.graphics.Canvas canvas, android.view.View containerView, boolean waitForCompletion)

        if (mDestroyRunnable.mNativeDrawGLFunctor == 0) {
            throw new RuntimeException("requested DrawGL on already destroyed DrawGLFunctor");
        }

        if (!mWebViewDelegate.canInvokeDrawGlFunctor(containerView)) {
            return false;
        }

        mDestroyRunnable.mContainerView = containerView;

        if (canvas == null) {
            mWebViewDelegate.invokeDrawGlFunctor(containerView,
                    mDestroyRunnable.mNativeDrawGLFunctor, waitForCompletion);
            return true;
        }

        mWebViewDelegate.callDrawGlFunction(canvas, mDestroyRunnable.mNativeDrawGLFunctor);
        if (waitForCompletion) {
            mWebViewDelegate.invokeDrawGlFunctor(containerView,
                    mDestroyRunnable.mNativeDrawGLFunctor, waitForCompletion);
        }
        return true;
    
public static voidsetChromiumAwDrawGLFunction(long functionPointer)

        nativeSetChromiumAwDrawGLFunction(functionPointer);