X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fbase%2Fandroid%2Fjni_android.h;h=b5e55263e0e6e0fbdc3c951361b663351f2fc748;hb=d41e52f18cc3fee3627acf2db026b2a86c2a9d18;hp=faf53b7400bbdecc305db289f470f05f70ab6251;hpb=4e9e197c26c34b7055b2c5de6d4a770d317b468c;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/base/android/jni_android.h b/src/base/android/jni_android.h index faf53b7..b5e5526 100644 --- a/src/base/android/jni_android.h +++ b/src/base/android/jni_android.h @@ -53,6 +53,15 @@ BASE_EXPORT bool IsVMInitialized(); BASE_EXPORT void InitApplicationContext(JNIEnv* env, const JavaRef& context); +// Initializes the global ClassLoader used by the GetClass and LazyGetClass +// methods. This is needed because JNI will use the base ClassLoader when there +// is no Java code on the stack. The base ClassLoader doesn't know about any of +// the application classes and will fail to lookup anything other than system +// classes. +BASE_EXPORT void InitReplacementClassLoader( + JNIEnv* env, + const JavaRef& class_loader); + // Gets a global ref to the application context set with // InitApplicationContext(). Ownership is retained by the function - the caller // must NOT release it. @@ -66,6 +75,17 @@ const BASE_EXPORT jobject GetApplicationContext(); BASE_EXPORT ScopedJavaLocalRef GetClass(JNIEnv* env, const char* class_name); +// The method will initialize |atomic_class_id| to contain a global ref to the +// class. And will return that ref on subsequent calls. It's the caller's +// responsibility to release the ref when it is no longer needed. +// The caller is responsible to zero-initialize |atomic_method_id|. +// It's fine to simultaneously call this on multiple threads referencing the +// same |atomic_method_id|. +BASE_EXPORT jclass LazyGetClass( + JNIEnv* env, + const char* class_name, + base::subtle::AtomicWord* atomic_class_id); + // This class is a wrapper for JNIEnv Get(Static)MethodID. class BASE_EXPORT MethodID { public: