| 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;
|
| }
|
|
|