| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/common/android/surface_texture_bridge.h" | 5 #include "content/common/android/surface_texture_bridge.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/common/android/surface_texture_listener.h" | 9 #include "content/common/android/surface_texture_listener.h" |
| 10 #include "jni/SurfaceTexture_jni.h" | 10 #include "jni/SurfaceTexture_jni.h" |
| 11 | 11 |
| 12 using base::android::AttachCurrentThread; | 12 using base::android::AttachCurrentThread; |
| 13 using base::android::CheckException; | 13 using base::android::CheckException; |
| 14 using base::android::GetClass; | 14 using base::android::GetClass; |
| 15 using base::android::GetMethodID; | |
| 16 using base::android::ScopedJavaLocalRef; | 15 using base::android::ScopedJavaLocalRef; |
| 17 | 16 |
| 18 namespace { | 17 namespace { |
| 19 bool g_jni_initialized = false; | 18 bool g_jni_initialized = false; |
| 20 | 19 |
| 21 void RegisterNativesIfNeeded(JNIEnv* env) { | 20 void RegisterNativesIfNeeded(JNIEnv* env) { |
| 22 if (!g_jni_initialized) { | 21 if (!g_jni_initialized) { |
| 23 JNI_SurfaceTexture::RegisterNativesImpl(env); | 22 JNI_SurfaceTexture::RegisterNativesImpl(env); |
| 24 g_jni_initialized = true; | 23 g_jni_initialized = true; |
| 25 } | 24 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void SurfaceTextureBridge::SetDefaultBufferSize(int width, int height) { | 97 void SurfaceTextureBridge::SetDefaultBufferSize(int width, int height) { |
| 99 JNIEnv* env = AttachCurrentThread(); | 98 JNIEnv* env = AttachCurrentThread(); |
| 100 CHECK(env); | 99 CHECK(env); |
| 101 | 100 |
| 102 JNI_SurfaceTexture::Java_SurfaceTexture_setDefaultBufferSize( | 101 JNI_SurfaceTexture::Java_SurfaceTexture_setDefaultBufferSize( |
| 103 env, j_surface_texture_.obj(), static_cast<jint>(width), | 102 env, j_surface_texture_.obj(), static_cast<jint>(width), |
| 104 static_cast<jint>(height)); | 103 static_cast<jint>(height)); |
| 105 } | 104 } |
| 106 | 105 |
| 107 } // namespace content | 106 } // namespace content |
| OLD | NEW |