Chromium Code Reviews| 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( |
|
picksi1
2014/10/28 11:37:08
This reads like you're checking if the linker is i
petrcermak
2014/10/28 12:16:48
I don't like the name either. It returns true iff
|
| + 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"); |
|
picksi1
2014/10/28 11:37:08
Is there a const or enum etc. we can use to avoid
petrcermak
2014/10/28 12:16:48
I removed this code. The point was that there shou
|
| + } |
| + |
| + 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. |