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

Unified Diff: chrome/browser/android/monochrome_entry_point.cc

Issue 2501193003: Selectively perform JNI registration in render processes on Android. (Closed)
Patch Set: Update NativeInit 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: chrome/browser/android/monochrome_entry_point.cc
diff --git a/chrome/browser/android/monochrome_entry_point.cc b/chrome/browser/android/monochrome_entry_point.cc
index a3c7f30457b627518a80a8f9137ec071ba72bc90..3ac599ded1f4cb54638b2c628ddf53389da729e1 100644
--- a/chrome/browser/android/monochrome_entry_point.cc
+++ b/chrome/browser/android/monochrome_entry_point.cc
@@ -15,20 +15,11 @@ bool Init() {
}
bool NativeInit() {
- JNIEnv* env = base::android::AttachCurrentThread();
- int library_process_type = base::android::GetLibraryProcessType(env);
- switch (library_process_type) {
- case base::android::PROCESS_WEBVIEW:
- case base::android::PROCESS_WEBVIEW_CHILD:
- return android_webview::OnJNIOnLoadInit();
- break;
- case base::android::PROCESS_BROWSER:
- case base::android::PROCESS_CHILD:
- return android::OnJNIOnLoadInit(base::Bind(&Init));
- break;
- default:
- NOTREACHED();
- return false;
+ if (base::android::GetJniRegistrationType() ==
Torne 2017/01/09 16:43:32 Don't use the JNI registration type to determine w
estevenson 2017/01/12 03:46:49 Done.
+ base::android::NO_JNI_REGISTRATION) {
+ return android_webview::OnJNIOnLoadInit();
+ } else {
+ return android::OnJNIOnLoadInit(base::Bind(&Init));
}
}
@@ -36,8 +27,8 @@ bool NativeInit() {
// This is called by the VM when the shared library is first loaded.
JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
- base::android::DisableManualJniRegistration();
base::android::InitVM(vm);
+ base::android::InitJniRegistrationType(base::android::AttachCurrentThread());
base::android::SetNativeInitializationHook(NativeInit);
return JNI_VERSION_1_4;
}

Powered by Google App Engine
This is Rietveld 408576698