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

Unified Diff: base/android/java/src/org/chromium/base/JNIUtils.java

Issue 2501193003: Selectively perform JNI registration in render processes on Android. (Closed)
Patch Set: Keep JniRegistrationType in native, add enableSelectiveJniRegistration to Java Created 3 years, 11 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/JNIUtils.java
diff --git a/base/android/java/src/org/chromium/base/JNIUtils.java b/base/android/java/src/org/chromium/base/JNIUtils.java
index f971b5e03cebd984bcd14066947c40a475f2afe4..cd7cc59885e6dc73ecd51b2beb8b64e907e02de8 100644
--- a/base/android/java/src/org/chromium/base/JNIUtils.java
+++ b/base/android/java/src/org/chromium/base/JNIUtils.java
@@ -12,6 +12,8 @@ import org.chromium.base.annotations.MainDex;
*/
@MainDex
public class JNIUtils {
+ private static boolean sSelectiveJniRegistrationEnabled;
+
/**
* This returns a ClassLoader that is capable of loading Chromium Java code. Such a ClassLoader
* is needed for the few cases where the JNI mechanism is unable to automatically determine the
@@ -21,4 +23,20 @@ public class JNIUtils {
public static Object getClassLoader() {
return JNIUtils.class.getClassLoader();
}
+
+ /**
+ * @return whether or not the current process supports selective JNI registration.
+ */
+ @CalledByNative
+ public static boolean isSelectiveJniRegistrationEnabled() {
+ return sSelectiveJniRegistrationEnabled;
+ }
+
+ /**
+ * Allow this process to selectively perform JNI registration. This must be called before
+ * loading native libraries or it will have no effect.
+ */
+ public static void enableSelectiveJniRegistration() {
+ sSelectiveJniRegistrationEnabled = true;
Ted C 2017/01/31 17:56:53 should we make sSelectiveJniRegistrationEnabled a
estevenson 2017/01/31 18:56:41 Good call. Done.
+ }
}

Powered by Google App Engine
This is Rietveld 408576698