Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Unified Diff: content/common/android/surface.cc

Issue 12388038: Android: Remove Surface cruft (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove more 'manual JNI' code Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698