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_onload.h" | 5 #include "base/android/base_jni_onload.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_utils.h" | 8 #include "base/android/jni_utils.h" |
9 #include "base/android/library_loader/library_loader_hooks.h" | 9 #include "base/android/library_loader/library_loader_hooks.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 namespace android { | 13 namespace android { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 bool RegisterJNI(JNIEnv* env) { | 17 bool RegisterJNI(JNIEnv* env) { |
18 return RegisterLibraryLoaderEntryHook(env); | 18 return RegisterLibraryLoaderEntryHook(env); |
19 } | 19 } |
20 | 20 |
21 bool Init() { | 21 bool Init() { |
| 22 InitAtExitManager(); |
22 JNIEnv* env = base::android::AttachCurrentThread(); | 23 JNIEnv* env = base::android::AttachCurrentThread(); |
23 base::android::InitReplacementClassLoader(env, | 24 base::android::InitReplacementClassLoader(env, |
24 base::android::GetClassLoader(env)); | 25 base::android::GetClassLoader(env)); |
25 return true; | 26 return true; |
26 } | 27 } |
27 | 28 |
28 } // namespace | 29 } // namespace |
29 | 30 |
30 | 31 |
31 bool OnJNIOnLoadRegisterJNI(JavaVM* vm, | 32 bool OnJNIOnLoadRegisterJNI(JavaVM* vm, |
(...skipping 15 matching lines...) Expand all Loading... |
47 for (std::vector<InitCallback>::reverse_iterator i = | 48 for (std::vector<InitCallback>::reverse_iterator i = |
48 callbacks.rbegin(); i != callbacks.rend(); ++i) { | 49 callbacks.rbegin(); i != callbacks.rend(); ++i) { |
49 if (!i->Run()) | 50 if (!i->Run()) |
50 return false; | 51 return false; |
51 } | 52 } |
52 return true; | 53 return true; |
53 } | 54 } |
54 | 55 |
55 } // namespace android | 56 } // namespace android |
56 } // namespace base | 57 } // namespace base |
OLD | NEW |