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

Unified Diff: base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java

Issue 611393002: Rationalize and fix chromium android linker histogram recording. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/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.

Powered by Google App Engine
This is Rietveld 408576698