| Index: content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java b/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
|
| index bf64b4feae831154cf77918067be6c29bd07b67b..60f73d7953c118288e7b0e13b091d9e7b5bf73c7 100644
|
| --- a/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
|
| +++ b/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
|
| @@ -8,6 +8,7 @@ import android.text.TextUtils;
|
| import android.util.Log;
|
|
|
| import org.chromium.base.JNINamespace;
|
| +import org.chromium.base.SysUtils;
|
| import org.chromium.content.common.CommandLine;
|
| import org.chromium.content.common.ProcessInitException;
|
| import org.chromium.content.common.ResultCodes;
|
| @@ -108,11 +109,28 @@ public class LibraryLoader {
|
| try {
|
| if (!sLoaded) {
|
| assert !sInitialized;
|
| - for (String sLibrary : NativeLibraries.libraries) {
|
| - Log.i(TAG, "loading: " + sLibrary);
|
| - System.loadLibrary(sLibrary);
|
| - Log.i(TAG, "loaded: " + sLibrary);
|
| +
|
| + long startTime = System.currentTimeMillis();
|
| + boolean useChromeLinker = Linker.isUsed();
|
| +
|
| + if (useChromeLinker)
|
| + Linker.prepareLibraryLoad();
|
| +
|
| + for (String library : NativeLibraries.libraries) {
|
| + Log.i(TAG, "Loading: " + library);
|
| + if (useChromeLinker) {
|
| + Linker.loadLibrary(library);
|
| + } else if (!library.equals("chrome_linker")) {
|
| + System.loadLibrary(library);
|
| + }
|
| }
|
| + if (useChromeLinker)
|
| + Linker.finishLibraryLoad();
|
| + long stopTime = System.currentTimeMillis();
|
| + Log.i(TAG, String.format("Time to load native libraries: %d ms (timestamps %d-%d)",
|
| + stopTime - startTime,
|
| + startTime % 10000,
|
| + stopTime % 10000));
|
| sLoaded = true;
|
| }
|
| } catch (UnsatisfiedLinkError e) {
|
| @@ -138,6 +156,10 @@ public class LibraryLoader {
|
| sInitialized = true;
|
| CommandLine.enableNativeProxy();
|
| TraceEvent.setEnabledToMatchNative();
|
| + // Record histogram for chrome linker.
|
| + if (Linker.isUsed())
|
| + nativeRecordContentAndroidLinkerHistogram(Linker.loadAtFixedAddressFailed(),
|
| + SysUtils.isLowEndDevice());
|
| }
|
|
|
| // This is the only method that is registered during System.loadLibrary. We then call it
|
| @@ -148,4 +170,10 @@ public class LibraryLoader {
|
| // Return 0 on success, otherwise return the error code from
|
| // content/public/common/result_codes.h.
|
| private static native int nativeLibraryLoaded(String[] initCommandLine);
|
| +
|
| + // Method called to register if the chrome linker was able to load library at a fixed address.
|
| + // This is called once the library loading is done and successful.
|
| + private static native void nativeRecordContentAndroidLinkerHistogram(
|
| + boolean loadedAtFixedAddressFailed,
|
| + boolean isLowMemoryDevice);
|
| }
|
|
|