| 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 c56d76c97d354f0886ad106f0ebdeb5b0d7b0544..93b6eb15f8b0452a8aee37b700a07d71f7b5b190 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
|
| @@ -314,6 +314,10 @@ public class LibraryLoader {
|
| nativeRecordChromiumAndroidLinkerBrowserHistogram(sIsUsingBrowserSharedRelros,
|
| sLoadAtFixedAddressFailed,
|
| getLibraryLoadFromApkStatus(context));
|
| + if (Linker.isInZipFile()) {
|
| + nativeRecordChromiumAndroidLinkerLibraryAlignmentInApk(
|
| + getLibraryAlignmentInApk(context));
|
| + }
|
| }
|
| }
|
|
|
| @@ -336,6 +340,27 @@ public class LibraryLoader {
|
| LibraryLoadFromApkStatusCodes.NOT_SUPPORTED;
|
| }
|
|
|
| + // Returns true if the Chromium library is page aligned in the APK file.
|
| + // This method can only be called when the Chromium linker is used and the library
|
| + // can be loaded directly from the APK file.
|
| + private static boolean getLibraryAlignmentInApk(Context context) {
|
| + assert Linker.isUsed();
|
| + assert Linker.isInZipFile();
|
| +
|
| + if (NativeLibraries.LIBRARIES.length != 2) {
|
| + Log.w(TAG, "NativeLibraryes.LIBRARIES should contain exactly 2 libraries");
|
| + }
|
| +
|
| + for (String library : NativeLibraries.LIBRARIES) {
|
| + if (!Linker.isLinkerLibrary(library)) {
|
| + return Linker.checkLibraryAlignedInApk(context.getApplicationInfo().sourceDir,
|
| + System.mapLibraryName(library));
|
| + }
|
| + }
|
| +
|
| + return false;
|
| + }
|
| +
|
| // Register pending Chromium linker histogram state for renderer processes. This cannot be
|
| // recorded as a histogram immediately because histograms and IPC are not ready at the
|
| // time it are captured. This function stores a pending value, so that a later call to
|
| @@ -367,6 +392,11 @@ public class LibraryLoader {
|
| boolean loadAtFixedAddressFailed,
|
| int libraryLoadFromApkStatus);
|
|
|
| + // Method called to record statistics about the page alignment of the Chromium library
|
| + // in the APK file.
|
| + private static native void nativeRecordChromiumAndroidLinkerLibraryAlignmentInApk(
|
| + boolean aligned);
|
| +
|
| // Method called to register (for later recording) statistics about the Chromium linker
|
| // operation for a renderer process. Indicates whether the linker attempted relro sharing,
|
| // and if it did, whether the library failed to load at a fixed address.
|
|
|