Index: base/android/jni_android.h |
diff --git a/base/android/jni_android.h b/base/android/jni_android.h |
index 66b3134e35d2b271760c2d9a19952c6affb15b97..5334f14e3a51a9c0dc032c26043ca33a84b6e68c 100644 |
--- a/base/android/jni_android.h |
+++ b/base/android/jni_android.h |
@@ -30,6 +30,19 @@ 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 0 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); |
+ 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 +57,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 0 if the field is not found. |
M-A Ruel
2011/11/11 16:22:28
technically, isn't it NULL instead of 0?
Steve Block
2011/11/11 16:31:34
Done.
M-A Ruel
2011/11/11 16:43:29
You forgot to upload again?
|
+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 |