Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BASE_ANDROID_JNI_ANDROID_H_ | |
| 6 #define BASE_ANDROID_JNI_ANDROID_H_ | |
| 7 | |
| 8 #include <jni.h> | |
| 9 #include <sys/types.h> | |
| 10 | |
| 11 namespace base { | |
| 12 namespace android { | |
| 13 | |
| 14 // Attach the current thread to the VM (if necessary) and return the JNIEnv*. | |
| 15 JNIEnv* AttachCurrentThread(); | |
| 16 | |
| 17 // Detach the current thread from VM if it is attached. | |
| 18 void DetachFromVM(); | |
| 19 | |
| 20 // Initializes the global JVM. It is not necessarily called before | |
| 21 // InitApplicationContext(). | |
| 22 void InitVM(JavaVM* vm); | |
| 23 | |
| 24 // Initializes the global application context object. The |context| should be | |
| 25 // the global reference of application context object. It is not necessarily | |
| 26 // called after InitVM(). | |
| 27 // TODO: We might combine InitVM() and InitApplicationContext() into one method. | |
| 28 void InitApplicationContext(jobject context); | |
| 29 | |
| 30 jobject GetApplicationContext(); | |
| 31 | |
| 32 // Get the method ID for a method. Will clear the pending Java | |
|
M-A Ruel
2011/11/11 13:09:07
Documentation style is inconsistent;
(To me) Havi
| |
| 33 // exception and return 0 if the method is not found. | |
| 34 jmethodID GetMethodID(JNIEnv* env, | |
| 35 jclass clazz, | |
| 36 const char* const method, | |
|
M-A Ruel
2011/11/11 13:12:42
Making the pointer itself const for function param
| |
| 37 const char* const jni_signature); | |
| 38 | |
| 39 // Returns true if an exception is pending in the provided JNIEnv*. | |
| 40 // If an exception is pending, it is printed. | |
| 41 bool CheckException(JNIEnv* env); | |
| 42 | |
| 43 } // namespace android | |
| 44 } // namespace base | |
| 45 #endif | |
| OLD | NEW |