OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_ANDROID_LIBRARY_LOADER_HOOKS_H_ |
| 6 #define BASE_ANDROID_LIBRARY_LOADER_HOOKS_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 namespace base { |
| 11 namespace android { |
| 12 |
| 13 // Registers the callbacks that allows the entry point of the library to be |
| 14 // exposed to the calling java code. This handles only registering the content |
| 15 // specific callbacks. Any application specific JNI bindings should happen |
| 16 // once the native library has fully loaded. |
| 17 bool RegisterLibraryLoaderEntryHook(JNIEnv* env); |
| 18 |
| 19 // Typedef for hook function to be called (indirectly from Java) once the |
| 20 // libraries are loaded. The hook function should register the JNI bindings |
| 21 // required to start the application. It should return true for success and |
| 22 // false for failure. |
| 23 // Note: this can't use base::Callback because there is no way of initializing |
| 24 // the default callback without using static objects, which we forbid. |
| 25 typedef bool LibraryLoaderHook(JNIEnv* env, |
| 26 jclass clazz, jobjectArray init_command_line); |
| 27 |
| 28 // Set the hook function to be called (from Java) once the libraries are loaded. |
| 29 // SetLibraryLoadedHook may only be called from JNI_OnLoad. The hook function |
| 30 // should register the JNI bindings required to start the application. |
| 31 |
| 32 void SetLibraryLoadedHook(LibraryLoaderHook* func); |
| 33 |
| 34 // Pass the version name to Content. This used to check that the library version |
| 35 // matches the version expected by Java before completing JNI registration. |
| 36 // Note: argument must remain valid at least until library loading is complete. |
| 37 void SetVersionNumber(const char* version_number); |
| 38 |
| 39 // Call on exit to delete the AtExitManager which OnLibraryLoadedOnUIThread |
| 40 // created. |
| 41 void LibraryLoaderExitHook(); |
| 42 |
| 43 } // namespace android |
| 44 } // namespace base |
| 45 |
| 46 #endif // BASE_ANDROID_LIBRARY_LOADER_HOOKS_H_ |
OLD | NEW |