OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/android/javatests/core_test.h" |
10 #include "mojo/services/native_viewport/native_viewport_android.h" | 10 #include "mojo/android/system/core_impl.h" |
11 #include "mojo/shell/android/mojo_main.h" | |
12 #include "net/android/net_jni_registrar.h" | |
13 | 11 |
14 namespace { | 12 namespace { |
15 | 13 |
16 base::android::RegistrationMethod kMojoRegisteredMethods[] = { | 14 base::android::RegistrationMethod kMojoRegisteredMethods[] = { |
17 { "MojoMain", mojo::RegisterMojoMain }, | 15 { "CoreImpl", mojo::android::RegisterCoreImpl }, |
18 { "NativeViewportAndroid", mojo::services::NativeViewportAndroid::Register }, | 16 { "CoreTest", mojo::android::RegisterCoreTest }, |
19 }; | 17 }; |
20 | 18 |
21 bool RegisterMojoJni(JNIEnv* env) { | 19 bool RegisterMojoJni(JNIEnv* env) { |
22 return RegisterNativeMethods(env, kMojoRegisteredMethods, | 20 return RegisterNativeMethods(env, kMojoRegisteredMethods, |
23 arraysize(kMojoRegisteredMethods)); | 21 arraysize(kMojoRegisteredMethods)); |
24 } | 22 } |
25 | 23 |
26 } // namespace | 24 } // namespace |
27 | 25 |
28 // This is called by the VM when the shared library is first loaded. | |
29 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 26 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
30 base::android::InitVM(vm); | 27 base::android::InitVM(vm); |
31 JNIEnv* env = base::android::AttachCurrentThread(); | 28 JNIEnv* env = base::android::AttachCurrentThread(); |
32 | 29 |
33 if (!base::android::RegisterLibraryLoaderEntryHook(env)) | 30 if (!base::android::RegisterLibraryLoaderEntryHook(env)) |
34 return -1; | 31 return -1; |
35 | 32 |
36 if (!base::android::RegisterJni(env)) | 33 if (!base::android::RegisterJni(env)) |
37 return -1; | 34 return -1; |
38 | 35 |
39 if (!net::android::RegisterJni(env)) | |
40 return -1; | |
41 | |
42 if (!RegisterMojoJni(env)) | 36 if (!RegisterMojoJni(env)) |
43 return -1; | 37 return -1; |
44 | 38 |
45 return JNI_VERSION_1_4; | 39 return JNI_VERSION_1_4; |
46 } | 40 } |
OLD | NEW |