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 |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 namespace android { | 15 namespace android { |
16 | 16 |
17 // Used to mark symbols to be exported in a shared library's symbol table. | 17 // Used to mark symbols to be exported in a shared library's symbol table. |
18 #define JNI_EXPORT __attribute__ ((visibility("default"))) | 18 #define JNI_EXPORT __attribute__ ((visibility("default"))) |
19 | 19 |
| 20 // Contains the registration method information for initializing JNI bindings. |
| 21 struct RegistrationMethod { |
| 22 const char* name; |
| 23 bool (*func)(JNIEnv* env); |
| 24 }; |
| 25 |
20 // Attach the current thread to the VM (if necessary) and return the JNIEnv*. | 26 // Attach the current thread to the VM (if necessary) and return the JNIEnv*. |
21 JNIEnv* AttachCurrentThread(); | 27 JNIEnv* AttachCurrentThread(); |
22 | 28 |
23 // Detach the current thread from VM if it is attached. | 29 // Detach the current thread from VM if it is attached. |
24 void DetachFromVM(); | 30 void DetachFromVM(); |
25 | 31 |
26 // Initializes the global JVM. It is not necessarily called before | 32 // Initializes the global JVM. It is not necessarily called before |
27 // InitApplicationContext(). | 33 // InitApplicationContext(). |
28 void InitVM(JavaVM* vm); | 34 void InitVM(JavaVM* vm); |
29 | 35 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // and returns true. | 133 // and returns true. |
128 bool ClearException(JNIEnv* env); | 134 bool ClearException(JNIEnv* env); |
129 | 135 |
130 // This function will call CHECK() macro if there's any pending exception. | 136 // This function will call CHECK() macro if there's any pending exception. |
131 void CheckException(JNIEnv* env); | 137 void CheckException(JNIEnv* env); |
132 | 138 |
133 } // namespace android | 139 } // namespace android |
134 } // namespace base | 140 } // namespace base |
135 | 141 |
136 #endif // BASE_ANDROID_JNI_ANDROID_H_ | 142 #endif // BASE_ANDROID_JNI_ANDROID_H_ |
OLD | NEW |