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

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

Issue 673093005: Fallback for loading library from a zipfile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 dcf0754e23ac642dcd000c8a4cfeb601f9689a4b..4e7c6d63ed2d1eed7e455d5fd35c77fcf2c47db5 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
@@ -161,9 +161,6 @@ public class LibraryLoader {
boolean useChromiumLinker = Linker.isUsed();
if (useChromiumLinker) {
- // Load libraries using the Chromium linker.
- Linker.prepareLibraryLoad();
-
// Check if the device supports loading a library directly from the APK file.
String apkfile = context.getApplicationInfo().sourceDir;
if (Linker.isInBrowserProcess()) {
@@ -171,6 +168,8 @@ public class LibraryLoader {
apkfile);
}
+ Linker.prepareLibraryLoad();
+
for (String library : NativeLibraries.LIBRARIES) {
String zipfile = null;
if (Linker.isInZipFile()) {
@@ -181,25 +180,27 @@ public class LibraryLoader {
}
boolean isLoaded = false;
+ String fallbackDir = context.getDir(
+ "fallback", Context.MODE_WORLD_READABLE).getPath();
if (Linker.isUsingBrowserSharedRelros()) {
sIsUsingBrowserSharedRelros = true;
try {
if (zipfile != null) {
- Linker.loadLibraryInZipFile(zipfile, library);
+ Linker.loadLibraryInZipFile(zipfile, library, fallbackDir);
} else {
Linker.loadLibrary(library);
}
isLoaded = true;
} catch (UnsatisfiedLinkError e) {
Log.w(TAG, "Failed to load native library with shared RELRO, " +
- "retrying without");
+ "retrying without");
Linker.disableSharedRelros();
sLoadAtFixedAddressFailed = true;
}
}
if (!isLoaded) {
if (zipfile != null) {
- Linker.loadLibraryInZipFile(zipfile, library);
+ Linker.loadLibraryInZipFile(zipfile, library, fallbackDir);
} else {
Linker.loadLibrary(library);
}
@@ -214,7 +215,7 @@ public class LibraryLoader {
System.loadLibrary(library);
} catch (UnsatisfiedLinkError e) {
if (context != null
- && LibraryLoaderHelper.tryLoadLibraryUsingWorkaround(context,
+ && LibraryLoaderHelper.tryLoadLibraryUsingWorkaround(context,
library)) {
sNativeLibraryHackWasUsed = true;
} else {
@@ -225,10 +226,10 @@ public class LibraryLoader {
}
if (context != null
- && shouldDeleteOldWorkaroundLibraries
- && !sNativeLibraryHackWasUsed) {
+ && shouldDeleteOldWorkaroundLibraries
+ && !sNativeLibraryHackWasUsed) {
LibraryLoaderHelper.deleteWorkaroundLibrariesAsynchronously(
- context);
+ context);
}
long stopTime = SystemClock.uptimeMillis();

Powered by Google App Engine
This is Rietveld 408576698