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

Unified Diff: android_webview/lib/main/webview_jni_onload.cc

Issue 975253002: refactoring Android Webview JNI_OnLoad interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 5 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/lib/main/webview_jni_onload.cc
diff --git a/android_webview/lib/main/webview_jni_onload.cc b/android_webview/lib/main/webview_jni_onload.cc
index 3e011903cb2dddcdf34012f5bc6b0b08db23c108..c41b912ef6ef8a1a88a67d18ef6faf806c3fcb2d 100644
--- a/android_webview/lib/main/webview_jni_onload.cc
+++ b/android_webview/lib/main/webview_jni_onload.cc
@@ -8,8 +8,10 @@
#include "android_webview/native/android_webview_jni_registrar.h"
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
+#include "base/bind.h"
#include "components/navigation_interception/component_jni_registrar.h"
#include "components/web_contents_delegate_android/component_jni_registrar.h"
+#include "content/public/app/content_jni_onload.h"
#include "content/public/app/content_main.h"
#include "url/url_util.h"
@@ -25,8 +27,6 @@ static base::android::RegistrationMethod
web_contents_delegate_android::RegisterWebContentsDelegateAndroidJni },
};
-} // namespace
-
bool RegisterJNI(JNIEnv* env) {
// Register JNI for components we depend on.
if (!RegisterNativeMethods(
@@ -49,4 +49,22 @@ bool Init() {
return true;
}
+} // namespace
+
+bool OnJNIOnLoadRegisterJNI(JavaVM* vm) {
+ // WebView uses native JNI exports; disable manual JNI registration to
+ // improve startup peformance.
+ base::android::DisableManualJniRegistration();
Torne 2015/03/05 18:56:09 I think we should leave this in JNI_OnLoad, since
michaelbai 2015/03/05 19:28:53 Will WebView always disable JNI Registration no ma
+
+ std::vector<base::android::RegisterCallback> register_callbacks;
+ register_callbacks.push_back(base::Bind(&RegisterJNI));
+ return content::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks);
+}
+
+bool OnJNIOnLoadInit() {
+ std::vector<base::android::InitCallback> init_callbacks;
+ init_callbacks.push_back(base::Bind(&Init));
+ return content::android::OnJNIOnLoadInit(init_callbacks);
+}
+
} // android_webview

Powered by Google App Engine
This is Rietveld 408576698