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
3 // found in the LICENSE file.
5 #ifndef UI_GL_ANDROID_SURFACE_TEXTURE_LISTENER_H_
6 #define UI_GL_ANDROID_SURFACE_TEXTURE_LISTENER_H_
9 #include "base/callback.h"
10 #include "base/memory/ref_counted.h"
11 #include "ui/gl/gl_export.h"
14 class MessageLoopProxy;
19 // Listener class for all the callbacks from android SurfaceTexture.
20 class GL_EXPORT SurfaceTextureListener {
22 // Destroy this listener.
23 void Destroy(JNIEnv* env, jobject obj);
25 // A new frame is available to consume.
26 void FrameAvailable(JNIEnv* env, jobject obj);
28 static bool RegisterSurfaceTextureListener(JNIEnv* env);
31 // Native code should not hold any reference to this object, and instead pass
32 // it up to Java for being referenced by a SurfaceTexture instance.
33 SurfaceTextureListener(const base::Closure& callback);
34 ~SurfaceTextureListener();
36 friend class SurfaceTexture;
38 base::Closure callback_;
40 scoped_refptr<base::MessageLoopProxy> browser_loop_;
42 DISALLOW_IMPLICIT_CONSTRUCTORS(SurfaceTextureListener);
47 #endif // UI_GL_ANDROID_SURFACE_TEXTURE_LISTENER_H_