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

Unified Diff: chromecast/app/android/cast_jni_loader.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
Index: chromecast/app/android/cast_jni_loader.cc
diff --git a/chromecast/app/android/cast_jni_loader.cc b/chromecast/app/android/cast_jni_loader.cc
index 6288ebb0b5a37991fb7a74ceefbf6e753780df96..79a32fefa64af71dd719f22398bc8ff1ea1e7eba 100644
--- a/chromecast/app/android/cast_jni_loader.cc
+++ b/chromecast/app/android/cast_jni_loader.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/android/jni_android.h"
+#include "base/android/library_loader/library_loader_hooks.h"
#include "base/bind.h"
#include "chromecast/android/cast_jni_registrar.h"
#include "chromecast/android/platform_jni_loader.h"
@@ -27,7 +28,9 @@ bool RegisterJNI(JNIEnv* env) {
return true;
}
-bool Init() {
+bool NativeInit() {
+ if (!content::android::OnJNIOnLoadInit())
+ return false;
content::Compositor::Initialize();
content::SetContentMainDelegate(new chromecast::shell::CastMainDelegate);
return true;
@@ -37,12 +40,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 | « chrome/browser/android/monochrome_entry_point.cc ('k') | components/cronet/android/cronet_library_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698