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

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

Issue 2045303002: Update to Chromium //base at Chromium commit 3e81715e6d3a4324362635aea46ce1f1a163cca1. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/domokit/base@master
Patch Set: Created 4 years, 6 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: android/java/src/org/chromium/base/library_loader/Linker.java
diff --git a/android/java/src/org/chromium/base/library_loader/Linker.java b/android/java/src/org/chromium/base/library_loader/Linker.java
index ee62570fed75a0fa23a1717cd6f75e7fea2225cf..c69628843a28f1b09cd6c34d372e80932b6bfa69 100644
--- a/android/java/src/org/chromium/base/library_loader/Linker.java
+++ b/android/java/src/org/chromium/base/library_loader/Linker.java
@@ -4,6 +4,7 @@
package org.chromium.base.library_loader;
+import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
@@ -223,15 +224,22 @@ public abstract class Linker {
/**
* Get singleton instance. Returns either a LegacyLinker or a ModernLinker.
*
+ * Returns a ModernLinker if running on Android M or later, otherwise returns
+ * a LegacyLinker.
+ *
+ * ModernLinker requires OS features from Android M and later: a system linker
+ * that handles packed relocations and load from APK, and android_dlopen_ext()
+ * for shared RELRO support. It cannot run on Android releases earlier than M.
+ *
+ * LegacyLinker runs on all Android releases but it is slower and more complex
+ * than ModernLinker, so ModernLinker is preferred for Android M and later.
+ *
* @return the Linker implementation instance.
*/
public static final Linker getInstance() {
synchronized (sSingletonLock) {
if (sSingleton == null) {
- // TODO(simonb): Check version once the Android M build version
- // code becomes available.
- // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.<ANDROID-M>) {
- if (false) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
sSingleton = ModernLinker.create();
} else {
sSingleton = LegacyLinker.create();
@@ -464,14 +472,14 @@ public abstract class Linker {
* if the initial load fails we retry with a suffix.
*/
protected void loadLinkerJNILibrary() {
- String lib_name = "lib" + LINKER_JNI_LIBRARY + ".so";
+ String libName = "lib" + LINKER_JNI_LIBRARY + ".so";
if (DEBUG) {
- Log.i(TAG, "Loading " + lib_name);
+ Log.i(TAG, "Loading " + libName);
}
try {
System.loadLibrary(LINKER_JNI_LIBRARY);
} catch (UnsatisfiedLinkError e) {
- Log.w(TAG, "Couldn't load " + lib_name + ", trying " + lib_name + ".so");
+ Log.w(TAG, "Couldn't load " + libName + ", trying " + libName + ".so");
System.loadLibrary(LINKER_JNI_LIBRARY + ".cr");
}
}

Powered by Google App Engine
This is Rietveld 408576698