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

Unified Diff: ui/gl/android/scoped_java_surface.cc

Issue 2146753002: Android: Remove unneeded RegisterNatives() calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, more fixes Created 4 years, 5 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: ui/gl/android/scoped_java_surface.cc
diff --git a/ui/gl/android/scoped_java_surface.cc b/ui/gl/android/scoped_java_surface.cc
index feb1e6905d988fcb0812293eed6c066b8e0c26c0..c3f37344ed217dc3b43667a9236c23018377818c 100644
--- a/ui/gl/android/scoped_java_surface.cc
+++ b/ui/gl/android/scoped_java_surface.cc
@@ -8,19 +8,6 @@
#include "jni/Surface_jni.h"
#include "ui/gl/android/surface_texture.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 gl {
ScopedJavaSurface::ScopedJavaSurface() {
@@ -31,7 +18,6 @@ ScopedJavaSurface::ScopedJavaSurface(
: auto_release_(true),
is_protected_(false) {
JNIEnv* env = base::android::AttachCurrentThread();
- RegisterNativesIfNeeded(env);
DCHECK(env->IsInstanceOf(surface.obj(), Surface_clazz(env)));
j_surface_.Reset(surface);
}
@@ -41,7 +27,6 @@ ScopedJavaSurface::ScopedJavaSurface(
: auto_release_(true),
is_protected_(false) {
JNIEnv* env = base::android::AttachCurrentThread();
- RegisterNativesIfNeeded(env);
ScopedJavaLocalRef<jobject> tmp(JNI_Surface::Java_Surface_Constructor(
env, surface_texture->j_surface_texture().obj()));
DCHECK(!tmp.is_null());

Powered by Google App Engine
This is Rietveld 408576698