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

Unified Diff: content/public/android/java/src/org/chromium/content/common/SurfaceTextureListener.java

Issue 10695020: upstream SurfaceTextureListener and SurfaceTextureBridge class for android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing nits Created 8 years, 6 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 | « content/content_jni.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/common/SurfaceTextureListener.java
diff --git a/content/public/android/java/src/org/chromium/content/common/SurfaceTextureListener.java b/content/public/android/java/src/org/chromium/content/common/SurfaceTextureListener.java
new file mode 100644
index 0000000000000000000000000000000000000000..d6ed16fc23515c1f32303342e15c3742716a7257
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content/common/SurfaceTextureListener.java
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.content.common;
+
+import android.graphics.SurfaceTexture;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+
+/**
+ * Listener to an android SurfaceTexture object for frame availability.
+ */
+@JNINamespace("content")
+class SurfaceTextureListener implements SurfaceTexture.OnFrameAvailableListener {
+ // Used to determine the class instance to dispatch the native call to.
+ private int mNativeSurfaceTextureListener = 0;
+
+ private SurfaceTextureListener(int nativeSurfaceTextureListener) {
+ assert nativeSurfaceTextureListener != 0;
+ mNativeSurfaceTextureListener = nativeSurfaceTextureListener;
+ }
+
+ @Override
+ public void onFrameAvailable(SurfaceTexture surfaceTexture) {
+ nativeFrameAvailable(mNativeSurfaceTextureListener);
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ try {
+ nativeDestroy(mNativeSurfaceTextureListener);
+ } finally {
+ super.finalize();
+ }
+ }
+
+ @CalledByNative
+ private static SurfaceTextureListener create(int nativeSurfaceTextureListener) {
+ return new SurfaceTextureListener(nativeSurfaceTextureListener);
+ }
+
+ private native void nativeFrameAvailable(int nativeSurfaceTextureListener);
+ private native void nativeDestroy(int nativeSurfaceTextureListener);
+}
« no previous file with comments | « content/content_jni.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698