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/core_impl.h" | 12 #include "mojo/android/system/core_impl.h" |
13 #include "sky/shell/android/platform_service_provider.h" | 13 #include "sky/shell/android/platform_service_provider_android.h" |
14 #include "sky/shell/android/platform_view.h" | 14 #include "sky/shell/android/platform_view_android.h" |
15 #include "sky/shell/android/sky_main.h" | 15 #include "sky/shell/android/sky_main.h" |
16 #include "sky/shell/android/tracing_controller.h" | 16 #include "sky/shell/android/tracing_controller.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 base::android::RegistrationMethod kSkyRegisteredMethods[] = { | 20 base::android::RegistrationMethod kSkyRegisteredMethods[] = { |
21 {"CoreImpl", mojo::android::RegisterCoreImpl}, | 21 {"CoreImpl", mojo::android::RegisterCoreImpl}, |
22 {"PlatformServiceProvider", sky::shell::RegisterPlatformServiceProvider}, | 22 {"PlatformServiceProvider", sky::shell::RegisterPlatformServiceProvider}, |
23 {"PlatformView", sky::shell::PlatformView::Register}, | 23 {"PlatformViewAndroid", sky::shell::PlatformViewAndroid::Register}, |
24 {"SkyMain", sky::shell::RegisterSkyMain}, | 24 {"SkyMain", sky::shell::RegisterSkyMain}, |
25 {"TracingController", sky::shell::RegisterTracingController}, | 25 {"TracingController", sky::shell::RegisterTracingController}, |
26 }; | 26 }; |
27 | 27 |
28 bool RegisterJNI(JNIEnv* env) { | 28 bool RegisterJNI(JNIEnv* env) { |
29 if (!base::android::RegisterJni(env)) | 29 if (!base::android::RegisterJni(env)) |
30 return false; | 30 return false; |
31 | 31 |
32 return RegisterNativeMethods(env, kSkyRegisteredMethods, | 32 return RegisterNativeMethods(env, kSkyRegisteredMethods, |
33 arraysize(kSkyRegisteredMethods)); | 33 arraysize(kSkyRegisteredMethods)); |
34 } | 34 } |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 // This is called by the VM when the shared library is first loaded. | 38 // This is called by the VM when the shared library is first loaded. |
39 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 39 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
40 std::vector<base::android::RegisterCallback> register_callbacks; | 40 std::vector<base::android::RegisterCallback> register_callbacks; |
41 register_callbacks.push_back(base::Bind(&RegisterJNI)); | 41 register_callbacks.push_back(base::Bind(&RegisterJNI)); |
42 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || | 42 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || |
43 !base::android::OnJNIOnLoadInit( | 43 !base::android::OnJNIOnLoadInit( |
44 std::vector<base::android::InitCallback>())) { | 44 std::vector<base::android::InitCallback>())) { |
45 return -1; | 45 return -1; |
46 } | 46 } |
47 | 47 |
48 return JNI_VERSION_1_4; | 48 return JNI_VERSION_1_4; |
49 } | 49 } |
OLD | NEW |