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

Unified Diff: sky/shell/library_loader.cc

Issue 1003813004: SkyShell DCHECKs on startup (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/library_loader.cc
diff --git a/sky/shell/library_loader.cc b/sky/shell/library_loader.cc
index 971c861ca82f72d6d07bbb3e3871370e51311191..dbe3b2a2781e156eba82d82176348df6ef3f6efc 100644
--- a/sky/shell/library_loader.cc
+++ b/sky/shell/library_loader.cc
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/android/base_jni_onload.h"
#include "base/android/base_jni_registrar.h"
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "base/android/library_loader/library_loader_hooks.h"
+#include "base/bind.h"
#include "base/logging.h"
#include "mojo/android/system/core_impl.h"
#include "sky/shell/java_service_provider.h"
@@ -21,7 +23,10 @@ base::android::RegistrationMethod kSkyRegisteredMethods[] = {
{"PlatformView", sky::shell::PlatformView::Register},
};
-bool RegisterSkyJni(JNIEnv* env) {
+bool RegisterJNI(JNIEnv* env) {
+ if (!base::android::RegisterJni(env))
+ return false;
+
return RegisterNativeMethods(env, kSkyRegisteredMethods,
arraysize(kSkyRegisteredMethods));
}
@@ -30,17 +35,13 @@ bool RegisterSkyJni(JNIEnv* env) {
// This is called by the VM when the shared library is first loaded.
JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
- base::android::InitVM(vm);
- JNIEnv* env = base::android::AttachCurrentThread();
-
- if (!base::android::RegisterLibraryLoaderEntryHook(env))
- return -1;
-
- if (!base::android::RegisterJni(env))
- return -1;
-
- if (!RegisterSkyJni(env))
+ std::vector<base::android::RegisterCallback> register_callbacks;
+ register_callbacks.push_back(base::Bind(&RegisterJNI));
+ if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) ||
+ !base::android::OnJNIOnLoadInit(
+ std::vector<base::android::InitCallback>())) {
return -1;
+ }
return JNI_VERSION_1_4;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698