OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/android/base_jni_onload.h" | 5 #include "base/android/base_jni_onload.h" |
6 #include "base/android/base_jni_registrar.h" | 6 #include "base/android/base_jni_registrar.h" |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_registrar.h" | 8 #include "base/android/jni_registrar.h" |
9 #include "base/android/library_loader/library_loader_hooks.h" | 9 #include "base/android/library_loader/library_loader_hooks.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "mojo/android/system/base_run_loop.h" |
12 #include "mojo/android/system/core_impl.h" | 13 #include "mojo/android/system/core_impl.h" |
13 #include "sky/shell/android/platform_service_provider_android.h" | 14 #include "sky/shell/android/platform_service_provider_android.h" |
14 #include "sky/shell/android/platform_view_android.h" | 15 #include "sky/shell/android/platform_view_android.h" |
15 #include "sky/shell/android/sky_main.h" | 16 #include "sky/shell/android/sky_main.h" |
16 #include "sky/shell/android/tracing_controller.h" | 17 #include "sky/shell/android/tracing_controller.h" |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 base::android::RegistrationMethod kSkyRegisteredMethods[] = { | 21 base::android::RegistrationMethod kSkyRegisteredMethods[] = { |
21 {"CoreImpl", mojo::android::RegisterCoreImpl}, | 22 {"CoreImpl", mojo::android::RegisterCoreImpl}, |
| 23 {"BaseRunLoop", mojo::android::RegisterBaseRunLoop}, |
22 {"PlatformServiceProvider", sky::shell::RegisterPlatformServiceProvider}, | 24 {"PlatformServiceProvider", sky::shell::RegisterPlatformServiceProvider}, |
23 {"PlatformViewAndroid", sky::shell::PlatformViewAndroid::Register}, | 25 {"PlatformViewAndroid", sky::shell::PlatformViewAndroid::Register}, |
24 {"SkyMain", sky::shell::RegisterSkyMain}, | 26 {"SkyMain", sky::shell::RegisterSkyMain}, |
25 {"TracingController", sky::shell::RegisterTracingController}, | 27 {"TracingController", sky::shell::RegisterTracingController}, |
26 }; | 28 }; |
27 | 29 |
28 bool RegisterJNI(JNIEnv* env) { | 30 bool RegisterJNI(JNIEnv* env) { |
29 if (!base::android::RegisterJni(env)) | 31 if (!base::android::RegisterJni(env)) |
30 return false; | 32 return false; |
31 | 33 |
32 return RegisterNativeMethods(env, kSkyRegisteredMethods, | 34 return RegisterNativeMethods(env, kSkyRegisteredMethods, |
33 arraysize(kSkyRegisteredMethods)); | 35 arraysize(kSkyRegisteredMethods)); |
34 } | 36 } |
35 | 37 |
36 } // namespace | 38 } // namespace |
37 | 39 |
38 // This is called by the VM when the shared library is first loaded. | 40 // This is called by the VM when the shared library is first loaded. |
39 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 41 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
40 std::vector<base::android::RegisterCallback> register_callbacks; | 42 std::vector<base::android::RegisterCallback> register_callbacks; |
41 register_callbacks.push_back(base::Bind(&RegisterJNI)); | 43 register_callbacks.push_back(base::Bind(&RegisterJNI)); |
42 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || | 44 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || |
43 !base::android::OnJNIOnLoadInit( | 45 !base::android::OnJNIOnLoadInit( |
44 std::vector<base::android::InitCallback>())) { | 46 std::vector<base::android::InitCallback>())) { |
45 return -1; | 47 return -1; |
46 } | 48 } |
47 | 49 |
48 return JNI_VERSION_1_4; | 50 return JNI_VERSION_1_4; |
49 } | 51 } |
OLD | NEW |