| Index: base/android/jni_android.h
|
| diff --git a/base/android/jni_android.h b/base/android/jni_android.h
|
| index 66b3134e35d2b271760c2d9a19952c6affb15b97..462173f85d38cf48b62e466ebeb97e1b0a6ea006 100644
|
| --- a/base/android/jni_android.h
|
| +++ b/base/android/jni_android.h
|
| @@ -30,6 +30,20 @@ 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_;
|
| +};
|
| +
|
| // Get the method ID for a method. Will clear the pending Java
|
| // exception and return 0 if the method is not found.
|
| jmethodID GetMethodID(JNIEnv* env,
|
| @@ -44,8 +58,15 @@ jmethodID GetStaticMethodID(JNIEnv* env,
|
| const char* const method,
|
| const char* const jni_signature);
|
|
|
| -// Returns true if an exception is pending in the provided JNIEnv*.
|
| -// If an exception is pending, it is printed.
|
| +// Gets the field ID for a class field. Clears the pending Java exception and
|
| +// returns NULL if the field is not found.
|
| +jfieldID GetFieldID(JNIEnv* env,
|
| + jclass clazz,
|
| + const char* field,
|
| + const char* jni_signature);
|
| +
|
| +// Returns true if an exception is pending in the provided JNIEnv*. If an
|
| +// exception is pending, this function prints and then clears it.
|
| bool CheckException(JNIEnv* env);
|
|
|
| } // namespace android
|
|
|