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 fc6d46fb99771f26383d788fbe41a2254caafc76..155cbffe00af938a6b64cf1421283cae6b5aca5a 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 |
| @@ -50,6 +50,10 @@ public class LibraryLoader { |
| private static boolean sIsUsingBrowserSharedRelros = false; |
| private static boolean sLoadAtFixedAddressFailed = false; |
| + // One-way switch recording whether the device supports memory mapping |
| + // APK files with executable permissions. |
|
rmcilroy
2014/10/10 16:26:08
add: Only used in the browser.
petrcermak
2014/10/10 17:13:23
Done.
|
| + private static boolean sApkMemoryMappingSupported = false; |
|
rmcilroy
2014/10/10 16:26:08
Can we make this a bit more generic (in case we ad
petrcermak
2014/10/10 17:13:24
Done.
|
| + |
| // 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. |
| @@ -160,6 +164,13 @@ public class LibraryLoader { |
| // Load libraries using the Chromium linker. |
| Linker.prepareLibraryLoad(); |
| + // Check if the device supports memory mapping APK files with executable |
| + // permissions. |
|
rmcilroy
2014/10/10 16:26:08
nit - "Check if the device supports loading a libr
petrcermak
2014/10/10 17:13:24
Done.
|
| + if (Linker.isInBrowserProcess()) { |
| + sApkMemoryMappingSupported = Linker.checkApkMemoryMappingSupport( |
| + context.getApplicationInfo().sourceDir); |
|
rmcilroy
2014/10/10 16:26:07
nit - pull out "context.getApplicationInfo().sourc
petrcermak
2014/10/10 17:13:23
Done.
|
| + } |
| + |
| for (String library : NativeLibraries.LIBRARIES) { |
| String zipfile = null; |
| if (Linker.isInZipFile()) { |
| @@ -305,8 +316,10 @@ public class LibraryLoader { |
| // onNativeInitializationComplete(). |
| private static void recordBrowserProcessHistogram() { |
| if (Linker.isUsed()) { |
| + assert Linker.isInBrowserProcess(); |
| nativeRecordChromiumAndroidLinkerBrowserHistogram(sIsUsingBrowserSharedRelros, |
| - sLoadAtFixedAddressFailed); |
| + sLoadAtFixedAddressFailed, |
| + sApkMemoryMappingSupported); |
| } |
| } |
| @@ -334,10 +347,12 @@ public class LibraryLoader { |
| // 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. |
| + // and if it did, whether the library failed to load at a fixed address. Also records |
| + // support for memory mapping APK files with executable permissions. |
| private static native void nativeRecordChromiumAndroidLinkerBrowserHistogram( |
| boolean isUsingBrowserSharedRelros, |
| - boolean loadAtFixedAddressFailed); |
| + boolean loadAtFixedAddressFailed, |
| + boolean apkMemoryMappingSupported); |
| // Method called to register (for later recording) statistics about the Chromium linker |
| // operation for a renderer process. Indicates whether the linker attempted relro sharing, |