Index: base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java |
diff --git a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java |
index 91e53678707f17b3b96a8b8bacaebe6ab07818de..2b959b692b5deb0f574abdb21024ddda36da7c8d 100644 |
--- a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java |
+++ b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java |
@@ -10,7 +10,6 @@ import android.util.Log; |
import org.chromium.base.CommandLine; |
import org.chromium.base.JNINamespace; |
-import org.chromium.base.SysUtils; |
import org.chromium.base.TraceEvent; |
/** |
@@ -46,6 +45,11 @@ public class LibraryLoader { |
// library_loader_hooks.cc). |
private static boolean sInitialized = false; |
+ // One-way switches recording attempts to use Relro sharing in the browser. |
+ // The flags are used to report UMA stats later. |
+ private static boolean sIsUsingBrowserSharedRelros = false; |
+ private static boolean sLoadAtFixedAddressFailed = false; |
+ |
// One-way switch becomes true if the system library loading failed, |
// and the right native library was found and loaded by the hack. |
// The flag is used to report UMA stats later. |
@@ -167,6 +171,7 @@ public class LibraryLoader { |
boolean isLoaded = false; |
if (Linker.isUsingBrowserSharedRelros()) { |
+ sIsUsingBrowserSharedRelros = true; |
try { |
if (zipfile != null) { |
Linker.loadLibraryInZipFile(zipfile, library); |
@@ -178,6 +183,7 @@ public class LibraryLoader { |
Log.w(TAG, "Failed to load native library with shared RELRO, " + |
"retrying without"); |
Linker.disableSharedRelros(); |
+ sLoadAtFixedAddressFailed = true; |
} |
} |
if (!isLoaded) { |
@@ -291,13 +297,17 @@ public class LibraryLoader { |
// Called after all native initializations are complete. |
public static void onNativeInitializationComplete() { |
- // Record histogram for the Chromium linker. |
+ recordBrowserProcessHistograms(); |
+ nativeRecordNativeLibraryHack(sNativeLibraryHackWasUsed); |
+ } |
+ |
+ // Record Chromium linker histograms for the main browser process. Called from |
+ // onNativeInitializationComplete(). |
+ private static void recordBrowserProcessHistograms() { |
if (Linker.isUsed()) { |
- nativeRecordChromiumAndroidLinkerHistogram(Linker.loadAtFixedAddressFailed(), |
- SysUtils.isLowEndDevice()); |
+ nativeRecordChromiumAndroidLinkerBrowserHistograms(sIsUsingBrowserSharedRelros, |
+ sLoadAtFixedAddressFailed); |
} |
- |
- nativeRecordNativeLibraryHack(sNativeLibraryHackWasUsed); |
} |
private static native void nativeInitCommandLine(String[] initCommandLine); |
@@ -310,12 +320,12 @@ public class LibraryLoader { |
// Return true on success and false on failure. |
private static native boolean nativeLibraryLoaded(); |
- // Method called to record statistics about the Chromium linker operation, |
- // i.e. whether the library failed to be loaded at a fixed address, and |
- // whether the device is 'low-memory'. |
- private static native void nativeRecordChromiumAndroidLinkerHistogram( |
- boolean loadedAtFixedAddressFailed, |
- boolean isLowMemoryDevice); |
+ // Method called to record statistics about the Chromium linker operation for the main |
+ // browser process. Indicates whether the linker attempted relro sharing for the browser, |
+ // and if it did, whether the library failed to load at a fixed address. |
+ private static native void nativeRecordChromiumAndroidLinkerBrowserHistograms( |
+ boolean isUsingBrowserSharedRelros, |
+ boolean loadedBrowserAtFixedAddressFailed); |
// Get the version of the native library. This is needed so that we can check we |
// have the right version before initializing the (rest of the) JNI. |