Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / base / android / library_loader / library_loader_hooks.h
1 // Copyright 2014 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 #include "base/base_export.h"
11
12 namespace base {
13 namespace android {
14
15 // Record any pending renderer histogram value as a histogram.  Pending values
16 // are set by RegisterChromiumAndroidLinkerRendererHistogram.
17 BASE_EXPORT void RecordChromiumAndroidLinkerRendererHistogram();
18
19 // Registers the callbacks that allows the entry point of the library to be
20 // exposed to the calling java code.  This handles only registering the
21 // the callbacks needed by the loader. Any application specific JNI bindings
22 // should happen once the native library has fully loaded, either in the library
23 // loaded hook function or later.
24 BASE_EXPORT bool RegisterLibraryLoaderEntryHook(JNIEnv* env);
25
26 // Typedef for hook function to be called (indirectly from Java) once the
27 // libraries are loaded. The hook function should register the JNI bindings
28 // required to start the application. It should return true for success and
29 // false for failure.
30 // Note: this can't use base::Callback because there is no way of initializing
31 // the default callback without using static objects, which we forbid.
32 typedef bool LibraryLoadedHook(JNIEnv* env,
33                                jclass clazz);
34
35 // Set the hook function to be called (from Java) once the libraries are loaded.
36 // SetLibraryLoadedHook may only be called from JNI_OnLoad. The hook function
37 // should register the JNI bindings required to start the application.
38
39 BASE_EXPORT void SetLibraryLoadedHook(LibraryLoadedHook* func);
40
41 // Pass the version name to the loader. This used to check that the library
42 // version matches the version expected by Java before completing JNI
43 // registration.
44 // Note: argument must remain valid at least until library loading is complete.
45 BASE_EXPORT void SetVersionNumber(const char* version_number);
46
47 // Call on exit to delete the AtExitManager which OnLibraryLoadedOnUIThread
48 // created.
49 BASE_EXPORT void LibraryLoaderExitHook();
50
51 }  // namespace android
52 }  // namespace base
53
54 #endif  // BASE_ANDROID_LIBRARY_LOADER_HOOKS_H_