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

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

Issue 11038015: Android: lazy initialization for method id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 2 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
« no previous file with comments | « content/browser/renderer_host/java/java_method.cc ('k') | content/common/android/surface_texture_bridge.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/android/surface_callback.cc
diff --git a/content/common/android/surface_callback.cc b/content/common/android/surface_callback.cc
index 77757e99ec92d4f5d6b5438292aaf887cb96a89e..7bfd033f5334713271ff3e02581191cfd3e9797f 100644
--- a/content/common/android/surface_callback.cc
+++ b/content/common/android/surface_callback.cc
@@ -19,7 +19,8 @@
using base::android::AttachCurrentThread;
using base::android::CheckException;
-using base::android::GetMethodID;
+using base::android::GetClass;
+using base::android::MethodID;
using base::WaitableEvent;
using content::SurfaceTexturePeer;
@@ -76,16 +77,12 @@ void ReleaseSurface(jobject surface) {
JNIEnv* env = AttachCurrentThread();
CHECK(env);
- jclass cls = env->FindClass("android/view/Surface");
- DCHECK(cls);
+ ScopedJavaLocalRef<jclass> cls(GetClass(env, "android/view/Surface"));
- jmethodID method = env->GetMethodID(cls, "release", "()V");
- DCHECK(method);
+ jmethodID method = MethodID::Get<MethodID::TYPE_INSTANCE>(
+ env, cls.obj(), "release", "()V");
env->CallVoidMethod(surface, method);
- DCHECK(env);
-
- env->DeleteLocalRef(cls);
}
void SetSurfaceAsync(JNIEnv* env,
« no previous file with comments | « content/browser/renderer_host/java/java_method.cc ('k') | content/common/android/surface_texture_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698