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 <string> | 11 #include <string> |
12 | 12 |
13 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
14 #include "base/atomicops.h" | 14 #include "base/atomicops.h" |
15 #include "base/base_export.h" | 15 #include "base/base_export.h" |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 namespace android { | 19 namespace android { |
20 | 20 |
21 // Used to mark symbols to be exported in a shared library's symbol table. | 21 // Used to mark symbols to be exported in a shared library's symbol table. |
22 #define JNI_EXPORT __attribute__ ((visibility("default"))) | 22 #define JNI_EXPORT __attribute__ ((visibility("default"))) |
23 | 23 |
24 // Used to disable manual JNI registration in binaries that prefer to use native | |
25 // JNI exports for startup performance. This is not compatible with the crazy | |
26 // linker and so defaults to off. Call DisableManualJniRegistration at the very | |
27 // beginning of JNI_OnLoad to use this. | |
28 BASE_EXPORT bool IsManualJniRegistrationDisabled(); | |
29 BASE_EXPORT void DisableManualJniRegistration(); | |
30 | |
31 // Contains the registration method information for initializing JNI bindings. | 24 // Contains the registration method information for initializing JNI bindings. |
32 struct RegistrationMethod { | 25 struct RegistrationMethod { |
33 const char* name; | 26 const char* name; |
34 bool (*func)(JNIEnv* env); | 27 bool (*func)(JNIEnv* env); |
35 }; | 28 }; |
36 | 29 |
37 // Attaches the current thread to the VM (if necessary) and return the JNIEnv*. | 30 // Attaches the current thread to the VM (if necessary) and return the JNIEnv*. |
38 BASE_EXPORT JNIEnv* AttachCurrentThread(); | 31 BASE_EXPORT JNIEnv* AttachCurrentThread(); |
39 | 32 |
40 // Same to AttachCurrentThread except that thread name will be set to | 33 // Same to AttachCurrentThread except that thread name will be set to |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // and returns true. | 120 // and returns true. |
128 BASE_EXPORT bool ClearException(JNIEnv* env); | 121 BASE_EXPORT bool ClearException(JNIEnv* env); |
129 | 122 |
130 // This function will call CHECK() macro if there's any pending exception. | 123 // This function will call CHECK() macro if there's any pending exception. |
131 BASE_EXPORT void CheckException(JNIEnv* env); | 124 BASE_EXPORT void CheckException(JNIEnv* env); |
132 | 125 |
133 } // namespace android | 126 } // namespace android |
134 } // namespace base | 127 } // namespace base |
135 | 128 |
136 #endif // BASE_ANDROID_JNI_ANDROID_H_ | 129 #endif // BASE_ANDROID_JNI_ANDROID_H_ |
OLD | NEW |