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

Unified Diff: base/android/library_loader/library_loader_hooks.cc

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, 12 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 side-by-side diff with in-line comments
Download patch
Index: base/android/library_loader/library_loader_hooks.cc
diff --git a/base/android/library_loader/library_loader_hooks.cc b/base/android/library_loader/library_loader_hooks.cc
index 473883c5e7cc256f3d51f4bcbdd92604ae8fc2de..621575c3f71d6fb9942a8ab7286df1e54942856f 100644
--- a/base/android/library_loader/library_loader_hooks.cc
+++ b/base/android/library_loader/library_loader_hooks.cc
@@ -21,6 +21,7 @@ namespace {
base::AtExitManager* g_at_exit_manager = NULL;
const char* g_library_version_number = "";
LibraryLoadedHook* g_registration_callback = NULL;
+NativeInitializationHook* g_native_initialization_hook = NULL;
enum RendererHistogramCode {
// Renderer load at fixed address success, fail, or not attempted.
@@ -149,6 +150,11 @@ static void RegisterLibraryPreloaderRendererHistogram(
g_library_preloader_renderer_histogram_code_registered = true;
}
+void SetNativeInitializationHook(
+ NativeInitializationHook native_initialization_hook) {
+ g_native_initialization_hook = native_initialization_hook;
+}
+
void RecordLibraryLoaderRendererHistograms() {
RecordChromiumAndroidLinkerRendererHistogram();
RecordLibraryPreloaderRendereHistogram();
@@ -167,6 +173,9 @@ static void InitCommandLine(
static jboolean LibraryLoaded(JNIEnv* env,
const JavaParamRef<jobject>& jcaller) {
+ if (g_native_initialization_hook && !g_native_initialization_hook()) {
+ return false;
+ }
if (g_registration_callback == NULL) {
Torne 2017/01/03 12:13:50 g_registration_callback already appears to be the
Tobias Sargeant 2017/01/04 00:24:53 I started doing this, and removing the callback ch
return true;
}

Powered by Google App Engine
This is Rietveld 408576698