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

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

Issue 2620303004: Remove JNI onload callback vector construction in favour of direct calls. (Closed)
Patch Set: 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 | « no previous file | base/android/base_jni_onload.h » ('j') | base/android/base_jni_onload.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 eb8d10d5f7227edb913f331b0f0a4b4e7bc66d91..ac1a6fae5a8d4f0397ff0b39a2d8f1c5dd822ee6 100644
--- a/android_webview/lib/main/webview_jni_onload.cc
+++ b/android_webview/lib/main/webview_jni_onload.cc
@@ -26,8 +26,14 @@ static base::android::RegistrationMethod
web_contents_delegate_android::RegisterWebContentsDelegateAndroidJni },
};
-bool RegisterJNI(JNIEnv* env) {
+} // namespace
+
+bool OnJNIOnLoadRegisterJNI(JavaVM* vm) {
+ if (!content::android::OnJNIOnLoadRegisterJNI(vm))
+ return false;
+
// Register JNI for components we depend on.
+ JNIEnv* env = base::android::AttachCurrentThread();
if (!RegisterNativeMethods(
env,
kWebViewDependencyRegisteredMethods,
@@ -38,7 +44,10 @@ bool RegisterJNI(JNIEnv* env) {
return true;
}
-bool Init() {
+bool OnJNIOnLoadInit() {
+ if (!content::android::OnJNIOnLoadInit())
+ return false;
+
base::android::SetVersionNumber(PRODUCT_VERSION);
content::SetContentMainDelegate(new android_webview::AwMainDelegate());
@@ -49,18 +58,4 @@ bool Init() {
return true;
}
-} // namespace
-
-bool OnJNIOnLoadRegisterJNI(JavaVM* vm) {
- 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
« no previous file with comments | « no previous file | base/android/base_jni_onload.h » ('j') | base/android/base_jni_onload.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698