Chromium Code Reviews| Index: content/common/android/surface.cc |
| diff --git a/content/common/android/surface.cc b/content/common/android/surface.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..916706a5de0edf0b52eabefe420d14024f694c0c |
| --- /dev/null |
| +++ b/content/common/android/surface.cc |
| @@ -0,0 +1,42 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
bulach
2013/03/04 10:44:51
nit: 2013 :)
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/common/android/surface.h" |
| + |
| +#include "jni/Surface_jni.h" |
| + |
| +namespace { |
| + |
| +bool g_jni_initialized = false; |
| + |
| +void RegisterNativesIfNeeded(JNIEnv* env) { |
| + if (!g_jni_initialized) { |
| + JNI_Surface::RegisterNativesImpl(env); |
| + g_jni_initialized = true; |
| + } |
| +} |
| + |
| +} // anonymous namespace |
| + |
| +namespace content { |
| + |
| +Surface::Surface(const base::android::JavaRef<jobject>& surface_texture) { |
| + JNIEnv* env = base::android::AttachCurrentThread(); |
| + RegisterNativesIfNeeded(env); |
| + |
| + ScopedJavaLocalRef<jobject> tmp( |
| + JNI_Surface::Java_Surface_Constructor(env, surface_texture.obj())); |
| + DCHECK(!tmp.is_null()); |
| + j_surface_.Reset(tmp); |
| +} |
| + |
| +Surface::~Surface() { |
| +} |
| + |
| +void Surface::Release() { |
| + JNIEnv* env = base::android::AttachCurrentThread(); |
| + 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
|
| +} |
| + |
| +} // namespace content |