Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: base/android/library_loader/library_loader_hooks.h

Issue 2593653002: Split JNI init so native library preloading dosn't cause native init. (Closed)
Patch Set: Add library initialization to AwCookieManager constructor Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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_LIBRARY_LOADER_LIBRARY_LOADER_HOOKS_H_ 5 #ifndef BASE_ANDROID_LIBRARY_LOADER_LIBRARY_LOADER_HOOKS_H_
6 #define BASE_ANDROID_LIBRARY_LOADER_LIBRARY_LOADER_HOOKS_H_ 6 #define BASE_ANDROID_LIBRARY_LOADER_LIBRARY_LOADER_HOOKS_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
11 #include "base/callback.h"
11 12
12 namespace base { 13 namespace base {
13 namespace android { 14 namespace android {
14 15
15 // The process the shared library is loaded in. 16 // The process the shared library is loaded in.
16 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.base.library_loader 17 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.base.library_loader
17 enum LibraryProcessType { 18 enum LibraryProcessType {
18 // The LibraryLoad has not been initialized. 19 // The LibraryLoad has not been initialized.
19 PROCESS_UNINITIALIZED = 0, 20 PROCESS_UNINITIALIZED = 0,
20 // Shared library is running in browser process. 21 // Shared library is running in browser process.
21 PROCESS_BROWSER = 1, 22 PROCESS_BROWSER = 1,
22 // Shared library is running in child process. 23 // Shared library is running in child process.
23 PROCESS_CHILD = 2, 24 PROCESS_CHILD = 2,
24 // Shared library is running in the app that uses webview. 25 // Shared library is running in the app that uses webview.
25 PROCESS_WEBVIEW = 3, 26 PROCESS_WEBVIEW = 3,
26 // Shared library is running in child process as part of webview. 27 // Shared library is running in child process as part of webview.
27 PROCESS_WEBVIEW_CHILD = 4, 28 PROCESS_WEBVIEW_CHILD = 4,
28 }; 29 };
29 30
31 typedef bool NativeInitializationHook();
32
33 BASE_EXPORT void SetNativeInitializationHook(
34 NativeInitializationHook native_initialization_hook);
35
30 // Record any pending renderer histogram value as histograms. Pending values 36 // Record any pending renderer histogram value as histograms. Pending values
31 // are set by RegisterChromiumAndroidLinkerRendererHistogram and 37 // are set by RegisterChromiumAndroidLinkerRendererHistogram and
32 // RegisterLibraryPreloaderRendererHistogram. 38 // RegisterLibraryPreloaderRendererHistogram.
33 BASE_EXPORT void RecordLibraryLoaderRendererHistograms(); 39 BASE_EXPORT void RecordLibraryLoaderRendererHistograms();
34 40
35 // Registers the callbacks that allows the entry point of the library to be 41 // Registers the callbacks that allows the entry point of the library to be
36 // exposed to the calling java code. This handles only registering the 42 // exposed to the calling java code. This handles only registering the
37 // the callbacks needed by the loader. Any application specific JNI bindings 43 // the callbacks needed by the loader. Any application specific JNI bindings
38 // should happen once the native library has fully loaded, either in the library 44 // should happen once the native library has fully loaded, either in the library
39 // loaded hook function or later. 45 // loaded hook function or later.
(...skipping 28 matching lines...) Expand all
68 BASE_EXPORT LibraryProcessType GetLibraryProcessType(JNIEnv* env); 74 BASE_EXPORT LibraryProcessType GetLibraryProcessType(JNIEnv* env);
69 75
70 // Initialize AtExitManager, this must be done at the begining of loading 76 // Initialize AtExitManager, this must be done at the begining of loading
71 // shared library. 77 // shared library.
72 void InitAtExitManager(); 78 void InitAtExitManager();
73 79
74 } // namespace android 80 } // namespace android
75 } // namespace base 81 } // namespace base
76 82
77 #endif // BASE_ANDROID_LIBRARY_LOADER_LIBRARY_LOADER_HOOKS_H_ 83 #endif // BASE_ANDROID_LIBRARY_LOADER_LIBRARY_LOADER_HOOKS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698