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 "sky/shell/sky_main.h" | 10 #include "sky/shell/sky_main.h" |
11 #include "sky/shell/sky_view.h" | |
11 | 12 |
12 namespace { | 13 namespace { |
13 | 14 |
14 base::android::RegistrationMethod kSkyRegisteredMethods[] = { | 15 base::android::RegistrationMethod kSkyRegisteredMethods[] = { |
eseidel1
2015/01/31 07:42:50
I'm not sure what this does.
|
abarth-chromium
2015/01/31 07:51:54
This table is used at startup to create a JNI brid
|
15 {"SkyMain", sky::shell::RegisterSkyMain}, | 16 {"SkyMain", sky::shell::RegisterSkyMain}, |
17 {"SkyView", sky::shell::SkyView::Register}, | |
16 }; | 18 }; |
17 | 19 |
18 bool RegisterMojoJni(JNIEnv* env) { | 20 bool RegisterMojoJni(JNIEnv* env) { |
19 return RegisterNativeMethods(env, kSkyRegisteredMethods, | 21 return RegisterNativeMethods(env, kSkyRegisteredMethods, |
20 arraysize(kSkyRegisteredMethods)); | 22 arraysize(kSkyRegisteredMethods)); |
21 } | 23 } |
22 | 24 |
23 } // namespace | 25 } // namespace |
24 | 26 |
25 // This is called by the VM when the shared library is first loaded. | 27 // This is called by the VM when the shared library is first loaded. |
26 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 28 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
27 base::android::InitVM(vm); | 29 base::android::InitVM(vm); |
28 JNIEnv* env = base::android::AttachCurrentThread(); | 30 JNIEnv* env = base::android::AttachCurrentThread(); |
29 | 31 |
30 if (!base::android::RegisterLibraryLoaderEntryHook(env)) | 32 if (!base::android::RegisterLibraryLoaderEntryHook(env)) |
31 return -1; | 33 return -1; |
32 | 34 |
33 if (!base::android::RegisterJni(env)) | 35 if (!base::android::RegisterJni(env)) |
34 return -1; | 36 return -1; |
35 | 37 |
36 if (!RegisterMojoJni(env)) | 38 if (!RegisterMojoJni(env)) |
37 return -1; | 39 return -1; |
38 | 40 |
39 return JNI_VERSION_1_4; | 41 return JNI_VERSION_1_4; |
40 } | 42 } |
OLD | NEW |