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

Side by Side Diff: base/android/jni_android.h

Issue 11038015: Android: lazy initialization for method id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split files Created 8 years, 2 months 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
« no previous file with comments | « no previous file | base/android/jni_android.cc » ('j') | base/android/jni_android_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const JavaRef<jclass>& clazz, 64 const JavaRef<jclass>& clazz,
65 const char* method_name, 65 const char* method_name,
66 const char* jni_signature); 66 const char* jni_signature);
67 67
68 // Similar to GetMethodID, but takes a raw jclass. 68 // Similar to GetMethodID, but takes a raw jclass.
69 jmethodID GetMethodID(JNIEnv* env, 69 jmethodID GetMethodID(JNIEnv* env,
70 jclass clazz, 70 jclass clazz,
71 const char* method_name, 71 const char* method_name,
72 const char* jni_signature); 72 const char* jni_signature);
73 73
74 // Unlike GetMethodID, returns NULL if the method could not be found.
75 jmethodID GetMethodIDOrNull(JNIEnv* env,
76 jclass clazz,
77 const char* method_name,
78 const char* jni_signature);
79
80 // Returns the method ID for the static method with the specified name and 74 // Returns the method ID for the static method with the specified name and
81 // signature. 75 // signature.
82 // This method triggers a fatal assertion if the method could not be found. 76 // This method triggers a fatal assertion if the method could not be found.
83 // Use HasMethod if you need to check whether a method exists. 77 // Use HasMethod if you need to check whether a method exists.
84 jmethodID GetStaticMethodID(JNIEnv* env, 78 jmethodID GetStaticMethodID(JNIEnv* env,
85 const JavaRef<jclass>& clazz, 79 const JavaRef<jclass>& clazz,
86 const char* method_name, 80 const char* method_name,
87 const char* jni_signature); 81 const char* jni_signature);
88 82
89 // Similar to the GetStaticMethodID, but takes a raw jclass. 83 // Similar to the GetStaticMethodID, but takes a raw jclass.
90 jmethodID GetStaticMethodID(JNIEnv* env, 84 jmethodID GetStaticMethodID(JNIEnv* env,
91 jclass clazz, 85 jclass clazz,
92 const char* method_name, 86 const char* method_name,
93 const char* jni_signature); 87 const char* jni_signature);
94 88
95 // Unlike GetStaticMethodID, returns NULL if the method could not be found.
96 jmethodID GetStaticMethodIDOrNull(JNIEnv* env,
97 jclass clazz,
98 const char* method_name,
99 const char* jni_signature);
100
101 // Returns true iff |clazz| has a method with the specified name and signature. 89 // Returns true iff |clazz| has a method with the specified name and signature.
102 bool HasMethod(JNIEnv* env, 90 bool HasMethod(JNIEnv* env,
103 const JavaRef<jclass>& clazz, 91 const JavaRef<jclass>& clazz,
104 const char* method_name, 92 const char* method_name,
105 const char* jni_signature); 93 const char* jni_signature);
106 94
107 // Gets the method ID from the class name. Clears the pending Java exception 95 // Gets the method ID from the class name. Clears the pending Java exception
108 // and returns NULL if the method is not found. Caches results. Note that 96 // and returns NULL if the method is not found. Caches results. Note that
109 // GetMethodID() below avoids a class lookup, but does not cache results. 97 // GetMethodID() below avoids a class lookup, but does not cache results.
110 // Strings passed to this function are held in the cache and MUST remain valid 98 // Strings passed to this function are held in the cache and MUST remain valid
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // and returns true. 132 // and returns true.
145 bool ClearException(JNIEnv* env); 133 bool ClearException(JNIEnv* env);
146 134
147 // This function will call CHECK() macro if there's any pending exception. 135 // This function will call CHECK() macro if there's any pending exception.
148 void CheckException(JNIEnv* env); 136 void CheckException(JNIEnv* env);
149 137
150 } // namespace android 138 } // namespace android
151 } // namespace base 139 } // namespace base
152 140
153 #endif // BASE_ANDROID_JNI_ANDROID_H_ 141 #endif // BASE_ANDROID_JNI_ANDROID_H_
OLDNEW
« no previous file with comments | « no previous file | base/android/jni_android.cc » ('j') | base/android/jni_android_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698