| 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 10 matching lines...) Expand all Loading... |
| 21 { "ValidationTestUtil", mojo::android::RegisterValidationTestUtil }, | 21 { "ValidationTestUtil", mojo::android::RegisterValidationTestUtil }, |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 bool RegisterJNI(JNIEnv* env) { | 24 bool RegisterJNI(JNIEnv* env) { |
| 25 return base::android::RegisterJni(env) && | 25 return base::android::RegisterJni(env) && |
| 26 RegisterNativeMethods(env, kMojoRegisteredMethods, | 26 RegisterNativeMethods(env, kMojoRegisteredMethods, |
| 27 arraysize(kMojoRegisteredMethods)); | 27 arraysize(kMojoRegisteredMethods)); |
| 28 } | 28 } |
| 29 | 29 |
| 30 bool Init() { | 30 bool Init() { |
| 31 mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>( | 31 // TODO(vtl): Use make_unique when C++14 is available. |
| 32 mojo::embedder::Init(std::unique_ptr<mojo::embedder::PlatformSupport>( |
| 32 new mojo::embedder::SimplePlatformSupport())); | 33 new mojo::embedder::SimplePlatformSupport())); |
| 33 return true; | 34 return true; |
| 34 } | 35 } |
| 35 | 36 |
| 36 } // namespace | 37 } // namespace |
| 37 | 38 |
| 38 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 39 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
| 39 std::vector<base::android::RegisterCallback> register_callbacks; | 40 std::vector<base::android::RegisterCallback> register_callbacks; |
| 40 register_callbacks.push_back(base::Bind(&RegisterJNI)); | 41 register_callbacks.push_back(base::Bind(&RegisterJNI)); |
| 41 std::vector<base::android::InitCallback> init_callbacks; | 42 std::vector<base::android::InitCallback> init_callbacks; |
| 42 init_callbacks.push_back(base::Bind(&Init)); | 43 init_callbacks.push_back(base::Bind(&Init)); |
| 43 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || | 44 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || |
| 44 !base::android::OnJNIOnLoadInit(init_callbacks)) | 45 !base::android::OnJNIOnLoadInit(init_callbacks)) |
| 45 return -1; | 46 return -1; |
| 46 | 47 |
| 47 return JNI_VERSION_1_4; | 48 return JNI_VERSION_1_4; |
| 48 } | 49 } |
| OLD | NEW |