Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
|
bulach
2013/03/04 10:44:51
nit: 2013 :)
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/common/android/surface.h" | |
| 6 | |
| 7 #include "jni/Surface_jni.h" | |
| 8 | |
| 9 namespace { | |
| 10 | |
| 11 bool g_jni_initialized = false; | |
| 12 | |
| 13 void RegisterNativesIfNeeded(JNIEnv* env) { | |
| 14 if (!g_jni_initialized) { | |
| 15 JNI_Surface::RegisterNativesImpl(env); | |
| 16 g_jni_initialized = true; | |
| 17 } | |
| 18 } | |
| 19 | |
| 20 } // anonymous namespace | |
| 21 | |
| 22 namespace content { | |
| 23 | |
| 24 Surface::Surface(const base::android::JavaRef<jobject>& surface_texture) { | |
| 25 JNIEnv* env = base::android::AttachCurrentThread(); | |
| 26 RegisterNativesIfNeeded(env); | |
| 27 | |
| 28 ScopedJavaLocalRef<jobject> tmp( | |
| 29 JNI_Surface::Java_Surface_Constructor(env, surface_texture.obj())); | |
| 30 DCHECK(!tmp.is_null()); | |
| 31 j_surface_.Reset(tmp); | |
| 32 } | |
| 33 | |
| 34 Surface::~Surface() { | |
| 35 } | |
| 36 | |
| 37 void Surface::Release() { | |
| 38 JNIEnv* env = base::android::AttachCurrentThread(); | |
| 39 JNI_Surface::Java_Surface_release(env, j_surface_.obj()); | |
|
bulach
2013/03/04 10:44:51
I see the naming clash here on Release vs Reset...
no sievers
2013/03/04 18:09:52
Actually, this method (in the java class) is named
bulach
2013/03/04 18:48:52
I agree it's going to be hard to fix the API namin
| |
| 40 } | |
| 41 | |
| 42 } // namespace content | |
| OLD | NEW |