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 #include "ui/gl/android/surface_texture_listener.h"
7 #include "base/location.h"
8 #include "base/logging.h"
9 #include "base/message_loop/message_loop_proxy.h"
10 #include "jni/SurfaceTextureListener_jni.h"
11 #include "ui/gl/android/surface_texture.h"
15 SurfaceTextureListener::SurfaceTextureListener(const base::Closure& callback)
16 : callback_(callback),
17 browser_loop_(base::MessageLoopProxy::current()) {
20 SurfaceTextureListener::~SurfaceTextureListener() {
23 void SurfaceTextureListener::Destroy(JNIEnv* env, jobject obj) {
27 void SurfaceTextureListener::FrameAvailable(JNIEnv* env, jobject obj) {
28 if (!browser_loop_->BelongsToCurrentThread()) {
29 browser_loop_->PostTask(FROM_HERE, callback_);
36 bool SurfaceTextureListener::RegisterSurfaceTextureListener(JNIEnv* env) {
37 return RegisterNativesImpl(env);