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

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: Address Ted C comments 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
« no previous file with comments | « android_webview/lib/main/webview_entry_point.cc ('k') | base/android/jni_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3fcec91316a9da55eb53289d77f1fafb194c692d 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,24 @@ 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() {
+ if (sSelectiveJniRegistrationEnabled == null) {
+ sSelectiveJniRegistrationEnabled = false;
+ }
+ 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() {
+ assert sSelectiveJniRegistrationEnabled == null;
+ sSelectiveJniRegistrationEnabled = true;
+ }
}
« no previous file with comments | « android_webview/lib/main/webview_entry_point.cc ('k') | base/android/jni_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698