diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/android/base_jni_registrar.h | 4 | ||||
-rw-r--r-- | base/android/jni_android.h | 59 | ||||
-rw-r--r-- | base/android/jni_array.h | 43 | ||||
-rw-r--r-- | base/android/jni_helper.h | 5 | ||||
-rw-r--r-- | base/android/jni_registrar.h | 7 | ||||
-rw-r--r-- | base/android/jni_string.h | 13 | ||||
-rw-r--r-- | base/android/locale_utils.h | 5 | ||||
-rw-r--r-- | base/android/path_utils.h | 8 | ||||
-rw-r--r-- | base/android/scoped_java_ref.h | 3 | ||||
-rw-r--r-- | base/message_pump_android.h | 3 | ||||
-rw-r--r-- | base/test/test_support_android.h | 10 |
11 files changed, 90 insertions, 70 deletions
diff --git a/base/android/base_jni_registrar.h b/base/android/base_jni_registrar.h index 678a3f3..fdaf5f2 100644 --- a/base/android/base_jni_registrar.h +++ b/base/android/base_jni_registrar.h @@ -7,11 +7,13 @@ #include <jni.h> +#include "base/base_export.h" + namespace base { namespace android { // Register all JNI bindings necessary for base. -bool RegisterJni(JNIEnv* env); +BASE_EXPORT bool RegisterJni(JNIEnv* env); } // namespace android } // namespace base diff --git a/base/android/jni_android.h b/base/android/jni_android.h index a3ac18a..16b85af 100644 --- a/base/android/jni_android.h +++ b/base/android/jni_android.h @@ -10,6 +10,7 @@ #include "base/android/scoped_java_ref.h" #include "base/atomicops.h" +#include "base/base_export.h" #include "base/compiler_specific.h" namespace base { @@ -25,41 +26,43 @@ struct RegistrationMethod { }; // Attach the current thread to the VM (if necessary) and return the JNIEnv*. -JNIEnv* AttachCurrentThread(); +BASE_EXPORT JNIEnv* AttachCurrentThread(); // Detach the current thread from VM if it is attached. -void DetachFromVM(); +BASE_EXPORT void DetachFromVM(); // Initializes the global JVM. It is not necessarily called before // InitApplicationContext(). -void InitVM(JavaVM* vm); +BASE_EXPORT void InitVM(JavaVM* vm); // Initializes the global application context object. The |context| can be any // valid reference to the application context. Internally holds a global ref to // the context. InitVM and InitApplicationContext maybe called in either order. -void InitApplicationContext(const JavaRef<jobject>& context); +BASE_EXPORT void InitApplicationContext(const JavaRef<jobject>& context); // Gets a global ref to the application context set with // InitApplicationContext(). Ownership is retained by the function - the caller // must NOT release it. -const jobject GetApplicationContext(); +const BASE_EXPORT jobject GetApplicationContext(); // Finds the class named |class_name| and returns it. // Use this method instead of invoking directly the JNI FindClass method (to // prevent leaking local references). // This method triggers a fatal assertion if the class could not be found. // Use HasClass if you need to check whether the class exists. -ScopedJavaLocalRef<jclass> GetClass(JNIEnv* env, const char* class_name); +BASE_EXPORT ScopedJavaLocalRef<jclass> GetClass(JNIEnv* env, + const char* class_name); // Similar to the above, but the caller is responsible to manage the jclass // lifetime. -jclass GetUnscopedClass(JNIEnv* env, const char* class_name) WARN_UNUSED_RESULT; +BASE_EXPORT jclass GetUnscopedClass(JNIEnv* env, + const char* class_name) WARN_UNUSED_RESULT; // Returns true iff the class |class_name| could be found. -bool HasClass(JNIEnv* env, const char* class_name); +BASE_EXPORT bool HasClass(JNIEnv* env, const char* class_name); // This class is a wrapper for JNIEnv Get(Static)MethodID. -class MethodID { +class BASE_EXPORT MethodID { public: enum Type { TYPE_STATIC, @@ -92,41 +95,41 @@ class MethodID { // beyond the duration of all future calls to this function, across all // threads. In practice, this means that the function should only be used with // string constants. -jmethodID GetMethodIDFromClassName(JNIEnv* env, - const char* class_name, - const char* method, - const char* jni_signature); +BASE_EXPORT jmethodID GetMethodIDFromClassName(JNIEnv* env, + const char* class_name, + const char* method, + const char* jni_signature); // Gets the field ID for a class field. // This method triggers a fatal assertion if the field could not be found. -jfieldID GetFieldID(JNIEnv* env, - const JavaRef<jclass>& clazz, - const char* field_name, - const char* jni_signature); +BASE_EXPORT jfieldID GetFieldID(JNIEnv* env, + const JavaRef<jclass>& clazz, + const char* field_name, + const char* jni_signature); // Returns true if |clazz| as a field with the given name and signature. // TODO(jcivelli): Determine whether we explicitly have to pass the environment. -bool HasField(JNIEnv* env, - const JavaRef<jclass>& clazz, - const char* field_name, - const char* jni_signature); - -// Gets the field ID for a static class field. -// This method triggers a fatal assertion if the field could not be found. -jfieldID GetStaticFieldID(JNIEnv* env, +BASE_EXPORT bool HasField(JNIEnv* env, const JavaRef<jclass>& clazz, const char* field_name, const char* jni_signature); +// Gets the field ID for a static class field. +// This method triggers a fatal assertion if the field could not be found. +BASE_EXPORT jfieldID GetStaticFieldID(JNIEnv* env, + const JavaRef<jclass>& clazz, + const char* field_name, + const char* jni_signature); + // Returns true if an exception is pending in the provided JNIEnv*. -bool HasException(JNIEnv* env); +BASE_EXPORT bool HasException(JNIEnv* env); // If an exception is pending in the provided JNIEnv*, this function clears it // and returns true. -bool ClearException(JNIEnv* env); +BASE_EXPORT bool ClearException(JNIEnv* env); // This function will call CHECK() macro if there's any pending exception. -void CheckException(JNIEnv* env); +BASE_EXPORT void CheckException(JNIEnv* env); } // namespace android } // namespace base diff --git a/base/android/jni_array.h b/base/android/jni_array.h index e9f6213..86433a3 100644 --- a/base/android/jni_array.h +++ b/base/android/jni_array.h @@ -17,42 +17,47 @@ namespace base { namespace android { // Returns a new Java byte array converted from the given bytes array. -ScopedJavaLocalRef<jbyteArray> ToJavaByteArray( +BASE_EXPORT ScopedJavaLocalRef<jbyteArray> ToJavaByteArray( JNIEnv* env, const uint8* bytes, size_t len); // Returns a array of Java byte array converted from |v|. -ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfByteArray( +BASE_EXPORT ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfByteArray( JNIEnv* env, const std::vector<std::string>& v); -ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfStrings( +BASE_EXPORT ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfStrings( JNIEnv* env, const std::vector<std::string>& v); -ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfStrings( +BASE_EXPORT ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfStrings( JNIEnv* env, const std::vector<string16>& v); // Converts a Java string array to a native array. -void AppendJavaStringArrayToStringVector(JNIEnv* env, - jobjectArray array, - std::vector<string16>* out); +BASE_EXPORT void AppendJavaStringArrayToStringVector( + JNIEnv* env, + jobjectArray array, + std::vector<string16>* out); -void AppendJavaStringArrayToStringVector(JNIEnv* env, - jobjectArray array, - std::vector<std::string>* out); +BASE_EXPORT void AppendJavaStringArrayToStringVector( + JNIEnv* env, + jobjectArray array, + std::vector<std::string>* out); // Appends the Java bytes in |bytes_array| onto the end of |out|. -void AppendJavaByteArrayToByteVector(JNIEnv* env, - jbyteArray byte_array, - std::vector<uint8>* out); +BASE_EXPORT void AppendJavaByteArrayToByteVector( + JNIEnv* env, + jbyteArray byte_array, + std::vector<uint8>* out); // Replaces the content of |out| with the Java bytes in |bytes_array|. -void JavaByteArrayToByteVector(JNIEnv* env, - jbyteArray byte_array, - std::vector<uint8>* out); +BASE_EXPORT void JavaByteArrayToByteVector( + JNIEnv* env, + jbyteArray byte_array, + std::vector<uint8>* out); // Replaces the content of |out| with the Java ints in |int_array|. -void JavaIntArrayToIntVector(JNIEnv* env, - jintArray int_array, - std::vector<int>* out); +BASE_EXPORT void JavaIntArrayToIntVector( + JNIEnv* env, + jintArray int_array, + std::vector<int>* out); } // namespace android } // namespace base diff --git a/base/android/jni_helper.h b/base/android/jni_helper.h index 22883cb..895bf95 100644 --- a/base/android/jni_helper.h +++ b/base/android/jni_helper.h @@ -7,13 +7,14 @@ #include <jni.h> +#include "base/base_export.h" #include "base/android/scoped_java_ref.h" // Manages WeakGlobalRef lifecycle. // This class is not thread-safe w.r.t. get() and reset(). Multiple threads may // safely use get() concurrently, but if the user calls reset() (or of course, // calls the destructor) they'll need to provide their own synchronization. -class JavaObjectWeakGlobalRef { +class BASE_EXPORT JavaObjectWeakGlobalRef { public: JavaObjectWeakGlobalRef(); JavaObjectWeakGlobalRef(const JavaObjectWeakGlobalRef& orig); @@ -34,7 +35,7 @@ class JavaObjectWeakGlobalRef { // Get the real object stored in the weak reference returned as a // ScopedJavaLocalRef. -base::android::ScopedJavaLocalRef<jobject> GetRealObject( +BASE_EXPORT base::android::ScopedJavaLocalRef<jobject> GetRealObject( JNIEnv* env, jweak obj); #endif // BASE_ANDROID_JNI_HELPER_H_ diff --git a/base/android/jni_registrar.h b/base/android/jni_registrar.h index ba8f074..849d07f 100644 --- a/base/android/jni_registrar.h +++ b/base/android/jni_registrar.h @@ -6,6 +6,7 @@ #define BASE_ANDROID_JNI_REGISTRAR_H_ #include <jni.h> +#include "base/base_export.h" #include "base/basictypes.h" namespace base { @@ -16,9 +17,9 @@ struct RegistrationMethod; // Registers the JNI bindings for the specified |method| definition containing // |count| elements. Returns whether the registration of the given methods // succeeded. -bool RegisterNativeMethods(JNIEnv* env, - const RegistrationMethod* method, - size_t count); +BASE_EXPORT bool RegisterNativeMethods(JNIEnv* env, + const RegistrationMethod* method, + size_t count); } // namespace android } // namespace base diff --git a/base/android/jni_string.h b/base/android/jni_string.h index 43194a15..62c4d02 100644 --- a/base/android/jni_string.h +++ b/base/android/jni_string.h @@ -9,26 +9,27 @@ #include <string> #include "base/android/scoped_java_ref.h" +#include "base/base_export.h" #include "base/string_piece.h" namespace base { namespace android { // Convert a Java string to UTF8. Returns a std string. -std::string ConvertJavaStringToUTF8(JNIEnv* env, jstring str); -std::string ConvertJavaStringToUTF8(const JavaRef<jstring>& str); +BASE_EXPORT std::string ConvertJavaStringToUTF8(JNIEnv* env, jstring str); +BASE_EXPORT std::string ConvertJavaStringToUTF8(const JavaRef<jstring>& str); // Convert a std string to Java string. -ScopedJavaLocalRef<jstring> ConvertUTF8ToJavaString( +BASE_EXPORT ScopedJavaLocalRef<jstring> ConvertUTF8ToJavaString( JNIEnv* env, const base::StringPiece& str); // Convert a Java string to UTF16. Returns a string16. -string16 ConvertJavaStringToUTF16(JNIEnv* env, jstring str); -string16 ConvertJavaStringToUTF16(const JavaRef<jstring>& str); +BASE_EXPORT string16 ConvertJavaStringToUTF16(JNIEnv* env, jstring str); +BASE_EXPORT string16 ConvertJavaStringToUTF16(const JavaRef<jstring>& str); // Convert a string16 to a Java string. -ScopedJavaLocalRef<jstring> ConvertUTF16ToJavaString( +BASE_EXPORT ScopedJavaLocalRef<jstring> ConvertUTF16ToJavaString( JNIEnv* env, const base::StringPiece16& str); diff --git a/base/android/locale_utils.h b/base/android/locale_utils.h index c7f8f33..cef39f4 100644 --- a/base/android/locale_utils.h +++ b/base/android/locale_utils.h @@ -9,15 +9,16 @@ #include <string> +#include "base/base_export.h" #include "base/string16.h" namespace base { namespace android { // Return the current default locale of the device. -std::string GetDefaultLocale(); +BASE_EXPORT std::string GetDefaultLocale(); -string16 GetDisplayNameForLocale(const std::string& locale, +BASE_EXPORT string16 GetDisplayNameForLocale(const std::string& locale, const std::string& display_locale); bool RegisterLocaleUtils(JNIEnv* env); diff --git a/base/android/path_utils.h b/base/android/path_utils.h index 37349d3..0d95cd3 100644 --- a/base/android/path_utils.h +++ b/base/android/path_utils.h @@ -7,6 +7,8 @@ #include <jni.h> +#include "base/base_export.h" + class FilePath; namespace base { @@ -16,13 +18,13 @@ namespace android { // application. The result is placed in the FilePath pointed to by 'result'. // This method is dedicated for base_paths_android.c, Using // PathService::Get(base::DIR_ANDROID_APP_DATA, ...) gets the data dir. -bool GetDataDirectory(FilePath* result); +BASE_EXPORT bool GetDataDirectory(FilePath* result); // Retrieves the absolute path to the cache directory. The result is placed in // the FilePath pointed to by 'result'. This method is dedicated for // base_paths_android.c, Using PathService::Get(base::DIR_CACHE, ...) gets the // cache dir. -bool GetCacheDirectory(FilePath* result); +BASE_EXPORT bool GetCacheDirectory(FilePath* result); // Retrieves the path to the public downloads directory. The result is placed // in the FilePath pointed to by 'result'. @@ -35,7 +37,7 @@ bool GetNativeLibraryDirectory(FilePath* result); // Retrieves the absolute path to the external storage directory. The result // is placed in the FilePath pointed to by 'result'. -bool GetExternalStorageDirectory(FilePath* result); +BASE_EXPORT bool GetExternalStorageDirectory(FilePath* result); bool RegisterPathUtils(JNIEnv* env); diff --git a/base/android/scoped_java_ref.h b/base/android/scoped_java_ref.h index 0d1e590..a5d71e2 100644 --- a/base/android/scoped_java_ref.h +++ b/base/android/scoped_java_ref.h @@ -8,6 +8,7 @@ #include <jni.h> #include <stddef.h> +#include "base/base_export.h" #include "base/basictypes.h" namespace base { @@ -20,7 +21,7 @@ template<typename T> class JavaRef; // other JavaRef<> template types. This allows you to e.g. pass // ScopedJavaLocalRef<jstring> into a function taking const JavaRef<jobject>& template<> -class JavaRef<jobject> { +class BASE_EXPORT JavaRef<jobject> { public: jobject obj() const { return obj_; } diff --git a/base/message_pump_android.h b/base/message_pump_android.h index 10a5582..5ef4bd6 100644 --- a/base/message_pump_android.h +++ b/base/message_pump_android.h @@ -7,6 +7,7 @@ #include <jni.h> +#include "base/base_export.h" #include "base/compiler_specific.h" #include "base/message_pump.h" @@ -17,7 +18,7 @@ class TimeTicks; // This class implements a MessagePump needed for TYPE_UI MessageLoops on // OS_ANDROID platform. -class MessagePumpForUI : public MessagePump { +class BASE_EXPORT MessagePumpForUI : public MessagePump { public: MessagePumpForUI(); diff --git a/base/test/test_support_android.h b/base/test/test_support_android.h index 40648cd..062785e 100644 --- a/base/test/test_support_android.h +++ b/base/test/test_support_android.h @@ -5,19 +5,21 @@ #ifndef BASE_TEST_TEST_SUPPORT_ANDROID_H_ #define BASE_TEST_TEST_SUPPORT_ANDROID_H_ +#include "base/base_export.h" + namespace base { // Init logging for tests on Android. Logs will be output into Android's logcat. -void InitAndroidTestLogging(); +BASE_EXPORT void InitAndroidTestLogging(); // Init path providers for tests on Android. -void InitAndroidTestPaths(); +BASE_EXPORT void InitAndroidTestPaths(); // Init the message loop for tests on Android. -void InitAndroidTestMessageLoop(); +BASE_EXPORT void InitAndroidTestMessageLoop(); // Do all of the initializations above. -void InitAndroidTest(); +BASE_EXPORT void InitAndroidTest(); } // namespace base |