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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_ANDROID_JNI_ANDROID_H_ 5 #ifndef BASE_ANDROID_JNI_ANDROID_H_
6 #define BASE_ANDROID_JNI_ANDROID_H_ 6 #define BASE_ANDROID_JNI_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 10
(...skipping 12 matching lines...) Expand all
23 23
24 // Initializes the global application context object. The |context| should be 24 // Initializes the global application context object. The |context| should be
25 // the global reference of application context object. It is not necessarily 25 // the global reference of application context object. It is not necessarily
26 // called after InitVM(). 26 // called after InitVM().
27 // TODO: We might combine InitVM() and InitApplicationContext() into one method. 27 // TODO: We might combine InitVM() and InitApplicationContext() into one method.
28 void InitApplicationContext(jobject context); 28 void InitApplicationContext(jobject context);
29 29
30 // Returns the application context assigned by InitApplicationContext(). 30 // Returns the application context assigned by InitApplicationContext().
31 jobject GetApplicationContext(); 31 jobject GetApplicationContext();
32 32
33 // Wraps a method ID.
34 class MethodID {
35 public:
36 jmethodID id() { return id_; }
37 protected:
38 // Gets the method ID from the class name. Clears the pending Java exception
39 // and returns 0 if the method is not found. Note that GetMethodID() below
40 // avoids a class lookup, so should be used in preference when possible.
41 MethodID(JNIEnv* env, const char* class_name, const char* method,
42 const char* jni_signature);
43 jmethodID id_;
44 };
45
33 // Get the method ID for a method. Will clear the pending Java 46 // Get the method ID for a method. Will clear the pending Java
34 // exception and return 0 if the method is not found. 47 // exception and return 0 if the method is not found.
35 jmethodID GetMethodID(JNIEnv* env, 48 jmethodID GetMethodID(JNIEnv* env,
36 jclass clazz, 49 jclass clazz,
37 const char* const method, 50 const char* const method,
38 const char* const jni_signature); 51 const char* const jni_signature);
39 52
40 // Get the method ID for a class static method. Will clear the pending Java 53 // Get the method ID for a class static method. Will clear the pending Java
41 // exception and return 0 if the method is not found. 54 // exception and return 0 if the method is not found.
42 jmethodID GetStaticMethodID(JNIEnv* env, 55 jmethodID GetStaticMethodID(JNIEnv* env,
43 jclass clazz, 56 jclass clazz,
44 const char* const method, 57 const char* const method,
45 const char* const jni_signature); 58 const char* const jni_signature);
46 59
47 // Returns true if an exception is pending in the provided JNIEnv*. 60 // Gets the field ID for a class field. Clears the pending Java exception and
48 // If an exception is pending, it is printed. 61 // 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?
62 jfieldID GetFieldID(JNIEnv* env,
63 jclass clazz,
64 const char* field,
65 const char* jni_signature);
66
67 // Returns true if an exception is pending in the provided JNIEnv*. If an
68 // exception is pending, this function prints and then clears it.
49 bool CheckException(JNIEnv* env); 69 bool CheckException(JNIEnv* env);
50 70
51 } // namespace android 71 } // namespace android
52 } // namespace base 72 } // namespace base
53 73
54 #endif // BASE_ANDROID_JNI_ANDROID_H_ 74 #endif // BASE_ANDROID_JNI_ANDROID_H_
OLDNEW
« 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