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_registrar.h" | 5 #include "base/android/base_jni_registrar.h" |
6 #include "base/android/jni_android.h" | 6 #include "base/android/jni_android.h" |
7 #include "base/android/jni_registrar.h" | 7 #include "base/android/jni_registrar.h" |
8 #include "base/android/library_loader/library_loader_hooks.h" | 8 #include "base/android/library_loader/library_loader_hooks.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "mojo/android/system/core_impl.h" |
| 11 #include "sky/shell/java_service_provider.h" |
| 12 #include "sky/shell/platform_view.h" |
10 #include "sky/shell/sky_main.h" | 13 #include "sky/shell/sky_main.h" |
11 #include "sky/shell/sky_view.h" | |
12 | 14 |
13 namespace { | 15 namespace { |
14 | 16 |
15 base::android::RegistrationMethod kSkyRegisteredMethods[] = { | 17 base::android::RegistrationMethod kSkyRegisteredMethods[] = { |
| 18 {"CoreImpl", mojo::android::RegisterCoreImpl}, |
| 19 {"JavaServiceProvider", sky::shell::RegisterJavaServiceProvider}, |
16 {"SkyMain", sky::shell::RegisterSkyMain}, | 20 {"SkyMain", sky::shell::RegisterSkyMain}, |
17 {"SkyView", sky::shell::SkyView::Register}, | 21 {"PlatformView", sky::shell::PlatformView::Register}, |
18 }; | 22 }; |
19 | 23 |
20 bool RegisterSkyJni(JNIEnv* env) { | 24 bool RegisterSkyJni(JNIEnv* env) { |
21 return RegisterNativeMethods(env, kSkyRegisteredMethods, | 25 return RegisterNativeMethods(env, kSkyRegisteredMethods, |
22 arraysize(kSkyRegisteredMethods)); | 26 arraysize(kSkyRegisteredMethods)); |
23 } | 27 } |
24 | 28 |
25 } // namespace | 29 } // namespace |
26 | 30 |
27 // This is called by the VM when the shared library is first loaded. | 31 // This is called by the VM when the shared library is first loaded. |
28 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 32 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
29 base::android::InitVM(vm); | 33 base::android::InitVM(vm); |
30 JNIEnv* env = base::android::AttachCurrentThread(); | 34 JNIEnv* env = base::android::AttachCurrentThread(); |
31 | 35 |
32 if (!base::android::RegisterLibraryLoaderEntryHook(env)) | 36 if (!base::android::RegisterLibraryLoaderEntryHook(env)) |
33 return -1; | 37 return -1; |
34 | 38 |
35 if (!base::android::RegisterJni(env)) | 39 if (!base::android::RegisterJni(env)) |
36 return -1; | 40 return -1; |
37 | 41 |
38 if (!RegisterSkyJni(env)) | 42 if (!RegisterSkyJni(env)) |
39 return -1; | 43 return -1; |
40 | 44 |
41 return JNI_VERSION_1_4; | 45 return JNI_VERSION_1_4; |
42 } | 46 } |
OLD | NEW |