| 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/library_loader/library_loader_hooks.h" | 5 #include "base/android/library_loader/library_loader_hooks.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "jni/LibraryLoader_jni.h" | 9 #include "jni/LibraryLoader_jni.h" |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 is_low_memory_device); | 42 is_low_memory_device); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void LibraryLoaderExitHook() { | 45 void LibraryLoaderExitHook() { |
| 46 if (g_at_exit_manager) { | 46 if (g_at_exit_manager) { |
| 47 delete g_at_exit_manager; | 47 delete g_at_exit_manager; |
| 48 g_at_exit_manager = NULL; | 48 g_at_exit_manager = NULL; |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { | |
| 53 // We need the AtExitManager to be created at the very beginning. | |
| 54 g_at_exit_manager = new base::AtExitManager(); | |
| 55 | |
| 56 return RegisterNativesImpl(env); | |
| 57 } | |
| 58 | |
| 59 void SetVersionNumber(const char* version_number) { | 52 void SetVersionNumber(const char* version_number) { |
| 60 g_library_version_number = strdup(version_number); | 53 g_library_version_number = strdup(version_number); |
| 61 } | 54 } |
| 62 | 55 |
| 63 jstring GetVersionNumber(JNIEnv* env, jclass clazz) { | 56 jstring GetVersionNumber(JNIEnv* env, jclass clazz) { |
| 64 return env->NewStringUTF(g_library_version_number); | 57 return env->NewStringUTF(g_library_version_number); |
| 65 } | 58 } |
| 66 | 59 |
| 67 static void RecordNativeLibraryHack(JNIEnv*, jclass, jboolean usedHack) { | 60 static void RecordNativeLibraryHack(JNIEnv*, jclass, jboolean usedHack) { |
| 68 UMA_HISTOGRAM_BOOLEAN("LibraryLoader.NativeLibraryHack", usedHack); | 61 UMA_HISTOGRAM_BOOLEAN("LibraryLoader.NativeLibraryHack", usedHack); |
| 69 } | 62 } |
| 70 | 63 |
| 71 } // namespace android | 64 } // namespace android |
| 72 } // namespace base | 65 } // namespace base |
| OLD | NEW |