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

Unified Diff: components/test/android/browsertests_apk/components_browser_tests_jni_onload.cc

Issue 2620303004: Remove JNI onload callback vector construction in favour of direct calls. (Closed)
Patch Set: rebase compile errors 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/cronet/android/test/cronet_test_jni.cc ('k') | content/app/android/content_jni_onload.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test/android/browsertests_apk/components_browser_tests_jni_onload.cc
diff --git a/components/test/android/browsertests_apk/components_browser_tests_jni_onload.cc b/components/test/android/browsertests_apk/components_browser_tests_jni_onload.cc
index df59922d15d193ed8efc7036a28cc405514a6c76..a2ec78b442dd6916478e5b531ae459716fde33cb 100644
--- a/components/test/android/browsertests_apk/components_browser_tests_jni_onload.cc
+++ b/components/test/android/browsertests_apk/components_browser_tests_jni_onload.cc
@@ -4,6 +4,7 @@
#include "base/android/base_jni_registrar.h"
#include "base/android/jni_android.h"
+#include "base/android/library_loader/library_loader_hooks.h"
#include "base/bind.h"
#include "content/public/app/content_jni_onload.h"
#include "content/public/app/content_main.h"
@@ -19,7 +20,9 @@ bool RegisterJNI(JNIEnv* env) {
testing::android::RegisterNativeTestJNI(env);
}
-bool Init() {
+bool NativeInit() {
+ if (!content::android::OnJNIOnLoadInit())
+ return false;
content::SetContentMainDelegate(new content::ShellMainDelegate());
return true;
}
@@ -28,12 +31,10 @@ bool Init() {
// This is called by the VM when the shared library is first loaded.
JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
- std::vector<base::android::RegisterCallback> register_callbacks;
- register_callbacks.push_back(base::Bind(&RegisterJNI));
- std::vector<base::android::InitCallback> init_callbacks;
- init_callbacks.push_back(base::Bind(&Init));
- if (!content::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) ||
- !content::android::OnJNIOnLoadInit(init_callbacks)) {
+ base::android::InitVM(vm);
+ JNIEnv* env = base::android::AttachCurrentThread();
+ if (!content::android::OnJNIOnLoadRegisterJNI(env) || !RegisterJNI(env) ||
+ !NativeInit()) {
return -1;
}
return JNI_VERSION_1_4;
« no previous file with comments | « components/cronet/android/test/cronet_test_jni.cc ('k') | content/app/android/content_jni_onload.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698