Chromium Code Reviews| 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..1ae64dea7611807edbb38e25b0707f4dc9c38241 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 |
| @@ -42,14 +42,6 @@ public class LibraryLoader { |
| // library_loader_hooks.cc). |
| private static boolean sInitialized = false; |
| - // TODO(cjhopman): Remove this once it's unused. |
| - /** |
| - * Doesn't do anything. |
| - */ |
| - @Deprecated |
| - public static void setLibraryToLoad(String library) { |
| - } |
| - |
| /** |
| * This method blocks until the library is fully loaded and initialized. |
| */ |
| @@ -108,11 +100,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 +147,9 @@ public class LibraryLoader { |
| sInitialized = true; |
| CommandLine.enableNativeProxy(); |
| TraceEvent.setEnabledToMatchNative(); |
| + // Record histogram for chrome linker. |
| + if (Linker.isUsed()) |
| + nativeRecordContentAndroidLinkerHistogram(Linker.loadAtFixedAddressFailed()); |
| } |
| // This is the only method that is registered during System.loadLibrary. We then call it |
| @@ -148,4 +160,9 @@ 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. |
|
palmer
2013/10/01 00:11:22
Nit: Indentation
digit1
2013/10/01 15:40:20
Done.
|
| + private static native void nativeRecordContentAndroidLinkerHistogram( |
| + boolean loadedAtFixedAddressFailed); |
| } |