Chromium Code Reviews| Index: base/android/jni_android.h |
| diff --git a/base/android/jni_android.h b/base/android/jni_android.h |
| index 462173f85d38cf48b62e466ebeb97e1b0a6ea006..8c805a6cff7b9b70bb4b0a90aec5749edc75ca42 100644 |
| --- a/base/android/jni_android.h |
| +++ b/base/android/jni_android.h |
| @@ -30,19 +30,16 @@ void InitApplicationContext(jobject context); |
| // Returns the application context assigned by InitApplicationContext(). |
| jobject GetApplicationContext(); |
| -// Wraps a method ID. |
| -class MethodID { |
| - public: |
| - jmethodID id() { return id_; } |
| - protected: |
| - // Gets the method ID from the class name. Clears the pending Java exception |
| - // and returns NULL if the method is not found. Note that GetMethodID() below |
| - // avoids a class lookup, so should be used in preference when possible. |
| - MethodID(JNIEnv* env, const char* class_name, const char* method, |
| - const char* jni_signature); |
| - private: |
| - jmethodID id_; |
| -}; |
| +// Gets the method ID from the class name. Clears the pending Java exception |
| +// and returns NULL if the method is not found. Caches results. Note that |
| +// GetMethodID() below avoids a class lookup, but does not cache results. |
| +// Note that strings passed to this function must remain unaltered for the |
| +// entire duration for which this function is in use. In practice, this means |
|
joth
2011/12/02 17:35:36
nit: "entire duration for which this function is i
|
| +// that the function should only be used with string constants. |
| +jmethodID GetMethodIDFromClassName(JNIEnv* env, |
| + const char* class_name, |
| + const char* method, |
| + const char* jni_signature); |
| // Get the method ID for a method. Will clear the pending Java |
| // exception and return 0 if the method is not found. |