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

Side by Side 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, 10 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.base; 5 package org.chromium.base;
6 6
7 import org.chromium.base.annotations.CalledByNative; 7 import org.chromium.base.annotations.CalledByNative;
8 import org.chromium.base.annotations.MainDex; 8 import org.chromium.base.annotations.MainDex;
9 9
10 /** 10 /**
11 * This class provides JNI-related methods to the native library. 11 * This class provides JNI-related methods to the native library.
12 */ 12 */
13 @MainDex 13 @MainDex
14 public class JNIUtils { 14 public class JNIUtils {
15 private static Boolean sSelectiveJniRegistrationEnabled;
16
15 /** 17 /**
16 * This returns a ClassLoader that is capable of loading Chromium Java code. Such a ClassLoader 18 * This returns a ClassLoader that is capable of loading Chromium Java code. Such a ClassLoader
17 * is needed for the few cases where the JNI mechanism is unable to automati cally determine the 19 * is needed for the few cases where the JNI mechanism is unable to automati cally determine the
18 * appropriate ClassLoader instance. 20 * appropriate ClassLoader instance.
19 */ 21 */
20 @CalledByNative 22 @CalledByNative
21 public static Object getClassLoader() { 23 public static Object getClassLoader() {
22 return JNIUtils.class.getClassLoader(); 24 return JNIUtils.class.getClassLoader();
23 } 25 }
26
27 /**
28 * @return whether or not the current process supports selective JNI registr ation.
29 */
30 @CalledByNative
31 public static boolean isSelectiveJniRegistrationEnabled() {
32 if (sSelectiveJniRegistrationEnabled == null) {
33 sSelectiveJniRegistrationEnabled = false;
34 }
35 return sSelectiveJniRegistrationEnabled;
36 }
37
38 /**
39 * Allow this process to selectively perform JNI registration. This must be called before
40 * loading native libraries or it will have no effect.
41 */
42 public static void enableSelectiveJniRegistration() {
43 assert sSelectiveJniRegistrationEnabled == null;
44 sSelectiveJniRegistrationEnabled = true;
45 }
24 } 46 }
OLDNEW
« 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