| Index: ui/gl/android/surface_texture.cc
|
| diff --git a/ui/gl/android/surface_texture.cc b/ui/gl/android/surface_texture.cc
|
| index 35f9b47288b6deb3ac9e865e826bed9edef872a2..a580041f3b73941f2be2798908cf69f534453d42 100644
|
| --- a/ui/gl/android/surface_texture.cc
|
| +++ b/ui/gl/android/surface_texture.cc
|
| @@ -26,12 +26,25 @@ bool GlContextMethodsAvailable() {
|
|
|
| namespace gfx {
|
|
|
| -SurfaceTexture::SurfaceTexture(int texture_id) {
|
| +scoped_refptr<SurfaceTexture> SurfaceTexture::Create(int texture_id) {
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
| - j_surface_texture_.Reset(
|
| + return new SurfaceTexture(
|
| Java_SurfaceTexturePlatformWrapper_create(env, texture_id));
|
| }
|
|
|
| +scoped_refptr<SurfaceTexture> SurfaceTexture::CreateSingleBuffered(
|
| + int texture_id) {
|
| + DCHECK(IsSingleBufferModeSupported());
|
| + JNIEnv* env = base::android::AttachCurrentThread();
|
| + return new SurfaceTexture(
|
| + Java_SurfaceTexturePlatformWrapper_createSingleBuffered(env, texture_id));
|
| +}
|
| +
|
| +SurfaceTexture::SurfaceTexture(
|
| + const base::android::ScopedJavaLocalRef<jobject>& j_surface_texture) {
|
| + j_surface_texture_.Reset(j_surface_texture);
|
| +}
|
| +
|
| SurfaceTexture::~SurfaceTexture() {
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
| Java_SurfaceTexturePlatformWrapper_destroy(env, j_surface_texture_.obj());
|
| @@ -52,6 +65,13 @@ void SurfaceTexture::UpdateTexImage() {
|
| j_surface_texture_.obj());
|
| }
|
|
|
| +void SurfaceTexture::ReleaseTexImage() {
|
| + DCHECK(IsSingleBufferModeSupported());
|
| + JNIEnv* env = base::android::AttachCurrentThread();
|
| + Java_SurfaceTexturePlatformWrapper_releaseTexImage(env,
|
| + j_surface_texture_.obj());
|
| +}
|
| +
|
| void SurfaceTexture::GetTransformMatrix(float mtx[16]) {
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
|
|
| @@ -109,6 +129,10 @@ ANativeWindow* SurfaceTexture::CreateSurface() {
|
| }
|
|
|
| // static
|
| +bool SurfaceTexture::IsSingleBufferModeSupported() {
|
| + return base::android::BuildInfo::GetInstance()->sdk_int() >= 19;
|
| +}
|
| +
|
| bool SurfaceTexture::RegisterSurfaceTexture(JNIEnv* env) {
|
| return RegisterNativesImpl(env);
|
| }
|
|
|