Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1841)

Unified Diff: base/android/java/src/org/chromium/base/library_loader/Linker.java

Issue 643803003: Add UMA for testing whether device supports memory mapping APK files with executable permissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase after 611393002 landed Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/android/java/src/org/chromium/base/library_loader/Linker.java
diff --git a/base/android/java/src/org/chromium/base/library_loader/Linker.java b/base/android/java/src/org/chromium/base/library_loader/Linker.java
index 93f05de9a93692c5d2608806e939334d2568a07e..93ed32e56d56503b370c6f29085c9bd384dbf975 100644
--- a/base/android/java/src/org/chromium/base/library_loader/Linker.java
+++ b/base/android/java/src/org/chromium/base/library_loader/Linker.java
@@ -136,7 +136,7 @@ import javax.annotation.Nullable;
*
* This behaviour is altered by the BROWSER_SHARED_RELRO_CONFIG configuration
* variable below, which may force the browser to load the libraries at
- * fixed addresses to.
+ * fixed addresses too.
*
* - Once all libraries are loaded in the browser process, one can call
* getSharedRelros() which returns a Bundle instance containing a map that
@@ -382,6 +382,19 @@ public class Linker {
}
/**
+ * Call this method to determine if the linker is running in the browser
+ * process.
+ *
+ * @return true if the linker is running in the browser process.
+ */
+ public static boolean isInBrowserProcess() {
+ synchronized (Linker.class) {
+ ensureInitializedLocked();
+ return sInBrowserProcess;
+ }
+ }
+
+ /**
* Call this method to determine if the chromium project must load
* the library directly from the zip file.
*/
@@ -820,6 +833,24 @@ public class Linker {
}
/**
+ * Check whether the device supports loading a library directly from the APK file.
+ *
+ * @param apkFile Filename of the APK.
+ * @return true if supported.
+ */
+ public static boolean checkLibraryLoadFromApkSupport(String apkFile) {
+ synchronized (Linker.class) {
+ ensureInitializedLocked();
+
+ if (DEBUG) Log.i(TAG, "checkLibraryLoadFromApkSupported: " + apkFile);
+ boolean supported = nativeCheckLibraryLoadFromApkSupport(apkFile);
+ if (DEBUG) Log.i(TAG, "Loading a library directly from the APK file " +
+ (supported ? "" : "NOT ") + "supported");
+ return supported;
+ }
+ }
+
+ /**
* Move activity from the native thread to the main UI thread.
* Called from native code on its own thread. Posts a callback from
* the UI thread back to native code.
@@ -917,6 +948,16 @@ public class Linker {
private static native long nativeGetRandomBaseLoadAddress(long sizeBytes);
/**
+ * Native method which checks whether the device supports loading a library
+ * directly from the APK file.
+ *
+ * @param apkFile Filename of the APK.
+ * @return true if supported.
+ *
+ */
+ private static native boolean nativeCheckLibraryLoadFromApkSupport(String apkFile);
+
+ /**
* Record information for a given library.
* IMPORTANT: Native code knows about this class's fields, so
* don't change them without modifying the corresponding C++ sources.

Powered by Google App Engine
This is Rietveld 408576698