OLD | NEW |
1 // Copyright 2014 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_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/bind.h" | 9 #include "base/bind.h" |
10 #include "mojo/android/javatests/mojo_test_case.h" | 10 #include "mojo/android/javatests/mojo_test_case.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 bool Init() { | 31 bool Init() { |
32 mojo::edk::Init(); | 32 mojo::edk::Init(); |
33 return true; | 33 return true; |
34 } | 34 } |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 38 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
| 39 base::android::InitVM(vm); |
| 40 base::android::InitJniRegistrationType(base::android::AttachCurrentThread(), |
| 41 false); |
39 std::vector<base::android::RegisterCallback> register_callbacks; | 42 std::vector<base::android::RegisterCallback> register_callbacks; |
40 register_callbacks.push_back(base::Bind(&RegisterJNI)); | 43 register_callbacks.push_back(base::Bind(&RegisterJNI)); |
41 std::vector<base::android::InitCallback> init_callbacks; | 44 std::vector<base::android::InitCallback> init_callbacks; |
42 init_callbacks.push_back(base::Bind(&Init)); | 45 init_callbacks.push_back(base::Bind(&Init)); |
43 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || | 46 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || |
44 !base::android::OnJNIOnLoadInit(init_callbacks)) | 47 !base::android::OnJNIOnLoadInit(init_callbacks)) |
45 return -1; | 48 return -1; |
46 | 49 |
47 return JNI_VERSION_1_4; | 50 return JNI_VERSION_1_4; |
48 } | 51 } |
OLD | NEW |