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

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: Moves to MethodID 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
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..71bc7591d84467e3c3d1c4027851c0768f7f95bc 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,13 @@ 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::METHODTYPE_NORMAL, MethodID::EXCEPTIONCHECK_YES>(
+ env, cls.obj(), "release", "()V");
env->CallVoidMethod(surface, method);
- DCHECK(env);
-
- env->DeleteLocalRef(cls);
}
void SetSurfaceAsync(JNIEnv* env,

Powered by Google App Engine
This is Rietveld 408576698