| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 package com.android.webview.chromium; | 5 package com.android.webview.chromium; | 
| 6 | 6 | 
| 7 import android.graphics.Canvas; | 7 import android.graphics.Canvas; | 
| 8 import android.os.Build; | 8 import android.os.Build; | 
| 9 import android.view.View; | 9 import android.view.View; | 
| 10 | 10 | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 32 | 32 | 
| 33     @Override | 33     @Override | 
| 34     public void detach(View containerView) { | 34     public void detach(View containerView) { | 
| 35         if (mDestroyRunnable.mNativeDrawGLFunctor == 0) { | 35         if (mDestroyRunnable.mNativeDrawGLFunctor == 0) { | 
| 36             throw new RuntimeException("detach on already destroyed DrawGLFuncto
     r"); | 36             throw new RuntimeException("detach on already destroyed DrawGLFuncto
     r"); | 
| 37         } | 37         } | 
| 38         mWebViewDelegate.detachDrawGlFunctor(containerView, mDestroyRunnable.mNa
     tiveDrawGLFunctor); | 38         mWebViewDelegate.detachDrawGlFunctor(containerView, mDestroyRunnable.mNa
     tiveDrawGLFunctor); | 
| 39     } | 39     } | 
| 40 | 40 | 
| 41     private static final boolean sSupportFunctorReleasedCallback = | 41     private static final boolean sSupportFunctorReleasedCallback = | 
| 42             (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) || "N".equals(Build.
     VERSION.CODENAME); | 42             (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) || Build.VERSION.COD
     ENAME.equals("N"); | 
| 43 | 43 | 
| 44     @Override | 44     @Override | 
| 45     public boolean requestDrawGL(Canvas canvas, Runnable releasedCallback) { | 45     public boolean requestDrawGL(Canvas canvas, Runnable releasedCallback) { | 
| 46         if (mDestroyRunnable.mNativeDrawGLFunctor == 0) { | 46         if (mDestroyRunnable.mNativeDrawGLFunctor == 0) { | 
| 47             throw new RuntimeException("requestDrawGL on already destroyed DrawG
     LFunctor"); | 47             throw new RuntimeException("requestDrawGL on already destroyed DrawG
     LFunctor"); | 
| 48         } | 48         } | 
| 49         assert canvas != null; | 49         assert canvas != null; | 
| 50         if (sSupportFunctorReleasedCallback) { | 50         if (sSupportFunctorReleasedCallback) { | 
| 51             assert releasedCallback != null; | 51             assert releasedCallback != null; | 
| 52             mWebViewDelegate.callDrawGlFunction( | 52             mWebViewDelegate.callDrawGlFunction( | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 103             assert mNativeDrawGLFunctor != 0; | 103             assert mNativeDrawGLFunctor != 0; | 
| 104             nativeDestroyGLFunctor(mNativeDrawGLFunctor); | 104             nativeDestroyGLFunctor(mNativeDrawGLFunctor); | 
| 105             mNativeDrawGLFunctor = 0; | 105             mNativeDrawGLFunctor = 0; | 
| 106         } | 106         } | 
| 107     } | 107     } | 
| 108 | 108 | 
| 109     private static native long nativeCreateGLFunctor(long viewContext); | 109     private static native long nativeCreateGLFunctor(long viewContext); | 
| 110     private static native void nativeDestroyGLFunctor(long functor); | 110     private static native void nativeDestroyGLFunctor(long functor); | 
| 111     private static native void nativeSetChromiumAwDrawGLFunction(long functionPo
     inter); | 111     private static native void nativeSetChromiumAwDrawGLFunction(long functionPo
     inter); | 
| 112 } | 112 } | 
| OLD | NEW | 
|---|