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

Unified Diff: webkit/glue/fling_animator_impl_android.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 | « ui/base/clipboard/clipboard_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/fling_animator_impl_android.cc
diff --git a/webkit/glue/fling_animator_impl_android.cc b/webkit/glue/fling_animator_impl_android.cc
index d663cb73d57f9d1cd45487cf3e9f2b38c6772e3c..56e7e8ba0ebc61079b4d93141e3c75cbdf7ad2e4 100644
--- a/webkit/glue/fling_animator_impl_android.cc
+++ b/webkit/glue/fling_animator_impl_android.cc
@@ -8,7 +8,12 @@
#include "base/android/scoped_java_ref.h"
#include "base/logging.h"
-using namespace base::android;
+using base::android::AttachCurrentThread;
+using base::android::CheckException;
+using base::android::GetApplicationContext;
+using base::android::GetClass;
+using base::android::MethodID;
+using base::android::ScopedJavaLocalRef;
namespace webkit_glue {
@@ -18,18 +23,23 @@ FlingAnimatorImpl::FlingAnimatorImpl()
JNIEnv* env = AttachCurrentThread();
DCHECK(env);
ScopedJavaLocalRef<jclass> cls(GetClass(env, "android/widget/OverScroller"));
- jmethodID constructor = GetMethodID(env, cls, "<init>",
- "(Landroid/content/Context;)V");
+ jmethodID constructor = MethodID::Get<MethodID::TYPE_INSTANCE>(
+ env, cls.obj(), "<init>", "(Landroid/content/Context;)V");
ScopedJavaLocalRef<jobject> tmp(env, env->NewObject(cls.obj(), constructor,
GetApplicationContext()));
DCHECK(tmp.obj());
java_scroller_.Reset(tmp);
- fling_method_id_ = GetMethodID(env, cls, "fling", "(IIIIIIII)V");
- abort_method_id_ = GetMethodID(env, cls, "abortAnimation", "()V");
- compute_method_id_ = GetMethodID(env, cls, "computeScrollOffset", "()Z");
- getX_method_id_ = GetMethodID(env, cls, "getCurrX", "()I");
- getY_method_id_ = GetMethodID(env, cls, "getCurrY", "()I");
+ fling_method_id_ = MethodID::Get<MethodID::TYPE_INSTANCE>(
+ env, cls.obj(), "fling", "(IIIIIIII)V");
+ abort_method_id_ = MethodID::Get<MethodID::TYPE_INSTANCE>(
+ env, cls.obj(), "abortAnimation", "()V");
+ compute_method_id_ = MethodID::Get<MethodID::TYPE_INSTANCE>(
+ env, cls.obj(), "computeScrollOffset", "()Z");
+ getX_method_id_ = MethodID::Get<MethodID::TYPE_INSTANCE>(
+ env, cls.obj(), "getCurrX", "()I");
+ getY_method_id_ = MethodID::Get<MethodID::TYPE_INSTANCE>(
+ env, cls.obj(), "getCurrY", "()I");
}
FlingAnimatorImpl::~FlingAnimatorImpl()
« no previous file with comments | « ui/base/clipboard/clipboard_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698