| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 // Initializes the global JVM. It is not necessarily called before | 34 // Initializes the global JVM. It is not necessarily called before |
| 35 // InitApplicationContext(). | 35 // InitApplicationContext(). |
| 36 BASE_EXPORT void InitVM(JavaVM* vm); | 36 BASE_EXPORT void InitVM(JavaVM* vm); |
| 37 | 37 |
| 38 // Returns true if the global JVM has been initialized. | 38 // Returns true if the global JVM has been initialized. |
| 39 BASE_EXPORT bool IsVMInitialized(); | 39 BASE_EXPORT bool IsVMInitialized(); |
| 40 | 40 |
| 41 // Initializes the global application context object. The |context| can be any | 41 // Initializes the global application context object. The |context| can be any |
| 42 // valid reference to the application context. Internally holds a global ref to | 42 // valid reference to the application context. Internally holds a global ref to |
| 43 // the context. InitVM and InitApplicationContext maybe called in either order. | 43 // the context. InitVM and InitApplicationContext maybe called in either order. |
| 44 BASE_EXPORT void InitApplicationContext(const JavaRef<jobject>& context); | 44 BASE_EXPORT void InitApplicationContext(JNIEnv* env, |
| 45 const JavaRef<jobject>& context); |
| 45 | 46 |
| 46 // Gets a global ref to the application context set with | 47 // Gets a global ref to the application context set with |
| 47 // InitApplicationContext(). Ownership is retained by the function - the caller | 48 // InitApplicationContext(). Ownership is retained by the function - the caller |
| 48 // must NOT release it. | 49 // must NOT release it. |
| 49 const BASE_EXPORT jobject GetApplicationContext(); | 50 const BASE_EXPORT jobject GetApplicationContext(); |
| 50 | 51 |
| 51 // Finds the class named |class_name| and returns it. | 52 // Finds the class named |class_name| and returns it. |
| 52 // Use this method instead of invoking directly the JNI FindClass method (to | 53 // Use this method instead of invoking directly the JNI FindClass method (to |
| 53 // prevent leaking local references). | 54 // prevent leaking local references). |
| 54 // This method triggers a fatal assertion if the class could not be found. | 55 // This method triggers a fatal assertion if the class could not be found. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // and returns true. | 91 // and returns true. |
| 91 BASE_EXPORT bool ClearException(JNIEnv* env); | 92 BASE_EXPORT bool ClearException(JNIEnv* env); |
| 92 | 93 |
| 93 // This function will call CHECK() macro if there's any pending exception. | 94 // This function will call CHECK() macro if there's any pending exception. |
| 94 BASE_EXPORT void CheckException(JNIEnv* env); | 95 BASE_EXPORT void CheckException(JNIEnv* env); |
| 95 | 96 |
| 96 } // namespace android | 97 } // namespace android |
| 97 } // namespace base | 98 } // namespace base |
| 98 | 99 |
| 99 #endif // BASE_ANDROID_JNI_ANDROID_H_ | 100 #endif // BASE_ANDROID_JNI_ANDROID_H_ |
| OLD | NEW |