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

Side by Side Diff: ui/android/java/src/org/chromium/ui/gfx/SurfaceTextureListener.java

Issue 22912020: Introduce facade for interaction with Android SurfaceTexture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fn order Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 org.chromium.ui.gfx; 5 package org.chromium.ui.gfx;
6 6
7 import android.graphics.SurfaceTexture; 7 import android.graphics.SurfaceTexture;
8 8
9 import org.chromium.base.CalledByNative;
10 import org.chromium.base.JNINamespace; 9 import org.chromium.base.JNINamespace;
11 10
12 /** 11 /**
13 * Listener to an android SurfaceTexture object for frame availability. 12 * Listener to an android SurfaceTexture object for frame availability.
14 */ 13 */
15 @JNINamespace("gfx") 14 @JNINamespace("gfx")
16 class SurfaceTextureListener implements SurfaceTexture.OnFrameAvailableListener { 15 class SurfaceTextureListener implements SurfaceTexture.OnFrameAvailableListener {
17 // Used to determine the class instance to dispatch the native call to. 16 // Used to determine the class instance to dispatch the native call to.
18 private int mNativeSurfaceTextureListener = 0; 17 private final int mNativeSurfaceTextureListener;
19 18
20 private SurfaceTextureListener(int nativeSurfaceTextureListener) { 19 SurfaceTextureListener(int nativeSurfaceTextureListener) {
21 assert nativeSurfaceTextureListener != 0; 20 assert nativeSurfaceTextureListener != 0;
22 mNativeSurfaceTextureListener = nativeSurfaceTextureListener; 21 mNativeSurfaceTextureListener = nativeSurfaceTextureListener;
23 } 22 }
24 23
25 @Override 24 @Override
26 public void onFrameAvailable(SurfaceTexture surfaceTexture) { 25 public void onFrameAvailable(SurfaceTexture surfaceTexture) {
27 nativeFrameAvailable(mNativeSurfaceTextureListener); 26 nativeFrameAvailable(mNativeSurfaceTextureListener);
28 } 27 }
29 28
30 @Override 29 @Override
31 protected void finalize() throws Throwable { 30 protected void finalize() throws Throwable {
32 try { 31 try {
33 nativeDestroy(mNativeSurfaceTextureListener); 32 nativeDestroy(mNativeSurfaceTextureListener);
34 } finally { 33 } finally {
35 super.finalize(); 34 super.finalize();
36 } 35 }
37 } 36 }
38 37
39 @CalledByNative
40 private static SurfaceTextureListener create(int nativeSurfaceTextureListene r) {
41 return new SurfaceTextureListener(nativeSurfaceTextureListener);
42 }
43
44 private native void nativeFrameAvailable(int nativeSurfaceTextureListener); 38 private native void nativeFrameAvailable(int nativeSurfaceTextureListener);
45 private native void nativeDestroy(int nativeSurfaceTextureListener); 39 private native void nativeDestroy(int nativeSurfaceTextureListener);
46 } 40 }
OLDNEW
« no previous file with comments | « ui/android/java/src/org/chromium/ui/gfx/SurfaceTextureBridge.java ('k') | ui/gl/android/gl_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698