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

Unified Diff: base/android/jni_android.h

Issue 8509019: Add JavaBoundObject (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed style Created 9 years, 1 month 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 | « no previous file | base/android/jni_android.cc » ('j') | content/browser/renderer_host/java/java_bound_object.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | base/android/jni_android.cc » ('j') | content/browser/renderer_host/java/java_bound_object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698