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 <jni.h> | 5 #include <jni.h> |
6 | 6 |
7 #include "base/android/base_jni_onload.h" | 7 #include "base/android/base_jni_onload.h" |
8 #include "base/android/base_jni_registrar.h" | 8 #include "base/android/base_jni_registrar.h" |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_registrar.h" | 10 #include "base/android/jni_registrar.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 {"CronetTestUtil", cronet::TestUtil::Register}, | 34 {"CronetTestUtil", cronet::TestUtil::Register}, |
35 }; | 35 }; |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 // This is called by the VM when the shared library is first loaded. | 39 // This is called by the VM when the shared library is first loaded. |
40 // Checks the available version of JNI. Also, caches Java reflection artifacts. | 40 // Checks the available version of JNI. Also, caches Java reflection artifacts. |
41 extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 41 extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
42 base::android::InitVM(vm); | 42 base::android::InitVM(vm); |
43 JNIEnv* env = base::android::AttachCurrentThread(); | 43 JNIEnv* env = base::android::AttachCurrentThread(); |
44 if (!base::android::OnJNIOnLoadRegisterJNI(env) || | 44 if (!base::android::OnJNIOnLoadInit()) { |
45 !base::android::OnJNIOnLoadInit()) { | |
46 return -1; | 45 return -1; |
47 } | 46 } |
48 | 47 |
49 if (!base::android::RegisterNativeMethods( | 48 if (!base::android::RegisterNativeMethods( |
50 env, | 49 env, |
51 kCronetTestsRegisteredMethods, | 50 kCronetTestsRegisteredMethods, |
52 arraysize(kCronetTestsRegisteredMethods))) { | 51 arraysize(kCronetTestsRegisteredMethods))) { |
53 return -1; | 52 return -1; |
54 } | 53 } |
55 return JNI_VERSION_1_6; | 54 return JNI_VERSION_1_6; |
56 } | 55 } |
57 | 56 |
58 extern "C" void JNI_OnUnLoad(JavaVM* vm, void* reserved) { | 57 extern "C" void JNI_OnUnLoad(JavaVM* vm, void* reserved) { |
59 base::android::LibraryLoaderExitHook(); | 58 base::android::LibraryLoaderExitHook(); |
60 } | 59 } |
OLD | NEW |