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