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

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

Issue 684453003: Add UMA for testing whether the Chromium library was page aligned in the APK file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added asserts to crazy linker 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/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..7137d1779843567b75aab87c5d41cafb68fac551 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
@@ -54,6 +54,10 @@ public class LibraryLoader {
// directly.
private static boolean sLibraryWasLoadedFromApk = false;
+ // One-way switch becomes false if the library was not aligned in the APK
+ // file.
rmcilroy 2014/10/28 13:07:15 if Linker.isInZipFile.
petrcermak 2014/10/28 13:48:15 Done.
+ private static boolean sLibraryWasAlignedInApk = true;
+
// 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.
@@ -165,9 +169,19 @@ public class LibraryLoader {
Linker.prepareLibraryLoad();
for (String library : NativeLibraries.LIBRARIES) {
+ // Don't self-load the linker. This is because the build system is
+ // not clever enough to understand that all the libraries packaged
+ // in the final .apk don't need to be explicitly loaded.
+ if (Linker.isLinkerLibrary(library)) {
+ if (Linker.DEBUG) Log.i(TAG, "ignoring self-linker load");
rmcilroy 2014/10/28 13:07:15 Don't use Linker.DEBUG here - have a seperate one
petrcermak 2014/10/28 13:48:15 Done (added a separate one).
+ continue;
+ }
+
String zipfile = null;
if (Linker.isInZipFile()) {
zipfile = context.getApplicationInfo().sourceDir;
+ sLibraryWasAlignedInApk = Linker.checkLibraryAlignedInApk(
+ zipfile, System.mapLibraryName(library));
Log.i(TAG, "Loading " + library + " from within " + zipfile);
} else {
Log.i(TAG, "Loading: " + library);
@@ -326,6 +340,10 @@ public class LibraryLoader {
return LibraryLoadFromApkStatusCodes.SUCCESSFUL;
}
+ if (!sLibraryWasAlignedInApk) {
+ return LibraryLoadFromApkStatusCodes.NOT_ALIGNED;
+ }
+
if (context == null) {
Log.w(TAG, "Unknown APK filename due to null context");
return LibraryLoadFromApkStatusCodes.UNKNOWN;

Powered by Google App Engine
This is Rietveld 408576698