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 |
24 // Contains the registration method information for initializing JNI bindings. | 31 // Contains the registration method information for initializing JNI bindings. |
25 struct RegistrationMethod { | 32 struct RegistrationMethod { |
26 const char* name; | 33 const char* name; |
27 bool (*func)(JNIEnv* env); | 34 bool (*func)(JNIEnv* env); |
28 }; | 35 }; |
29 | 36 |
30 // Attaches the current thread to the VM (if necessary) and return the JNIEnv*. | 37 // Attaches the current thread to the VM (if necessary) and return the JNIEnv*. |
31 BASE_EXPORT JNIEnv* AttachCurrentThread(); | 38 BASE_EXPORT JNIEnv* AttachCurrentThread(); |
32 | 39 |
33 // Same to AttachCurrentThread except that thread name will be set to | 40 // Same to AttachCurrentThread except that thread name will be set to |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // and returns true. | 127 // and returns true. |
121 BASE_EXPORT bool ClearException(JNIEnv* env); | 128 BASE_EXPORT bool ClearException(JNIEnv* env); |
122 | 129 |
123 // This function will call CHECK() macro if there's any pending exception. | 130 // This function will call CHECK() macro if there's any pending exception. |
124 BASE_EXPORT void CheckException(JNIEnv* env); | 131 BASE_EXPORT void CheckException(JNIEnv* env); |
125 | 132 |
126 } // namespace android | 133 } // namespace android |
127 } // namespace base | 134 } // namespace base |
128 | 135 |
129 #endif // BASE_ANDROID_JNI_ANDROID_H_ | 136 #endif // BASE_ANDROID_JNI_ANDROID_H_ |
OLD | NEW |