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/android/command_line_android.h" |
7 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
8 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
9 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
10 #include "jni/LibraryLoader_jni.h" | 11 #include "jni/LibraryLoader_jni.h" |
11 | 12 |
12 namespace base { | 13 namespace base { |
13 namespace android { | 14 namespace android { |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 base::AtExitManager* g_at_exit_manager = NULL; | 18 base::AtExitManager* g_at_exit_manager = NULL; |
18 const char* g_library_version_number = ""; | 19 const char* g_library_version_number = ""; |
19 LibraryLoadedHook* g_registration_callback = NULL; | 20 LibraryLoadedHook* g_registration_callback = NULL; |
20 | 21 |
21 } // namespace | 22 } // namespace |
22 | 23 |
23 void SetLibraryLoadedHook(LibraryLoadedHook* func) { | 24 void SetLibraryLoadedHook(LibraryLoadedHook* func) { |
24 g_registration_callback = func; | 25 g_registration_callback = func; |
25 } | 26 } |
26 | 27 |
27 static jboolean LibraryLoaded(JNIEnv* env, jclass clazz, | 28 static void InitCommandLine(JNIEnv* env, jclass clazz, |
28 jobjectArray init_command_line) { | 29 jobjectArray init_command_line) { |
| 30 InitNativeCommandLineFromJavaArray(env, init_command_line); |
| 31 } |
| 32 |
| 33 static jboolean LibraryLoaded(JNIEnv* env, jclass clazz) { |
29 if(g_registration_callback == NULL) { | 34 if(g_registration_callback == NULL) { |
30 return true; | 35 return true; |
31 } | 36 } |
32 return g_registration_callback(env, clazz, init_command_line); | 37 return g_registration_callback(env, clazz); |
33 } | 38 } |
34 | 39 |
35 static void RecordChromiumAndroidLinkerHistogram( | 40 static void RecordChromiumAndroidLinkerHistogram( |
36 JNIEnv* env, | 41 JNIEnv* env, |
37 jclass clazz, | 42 jclass clazz, |
38 jboolean loaded_at_fixed_address_failed, | 43 jboolean loaded_at_fixed_address_failed, |
39 jboolean is_low_memory_device) { | 44 jboolean is_low_memory_device) { |
40 UMA_HISTOGRAM_BOOLEAN("ChromiumAndroidLinker.LoadedAtFixedAddressFailed", | 45 UMA_HISTOGRAM_BOOLEAN("ChromiumAndroidLinker.LoadedAtFixedAddressFailed", |
41 loaded_at_fixed_address_failed); | 46 loaded_at_fixed_address_failed); |
42 UMA_HISTOGRAM_BOOLEAN("ChromiumAndroidLinker.IsLowMemoryDevice", | 47 UMA_HISTOGRAM_BOOLEAN("ChromiumAndroidLinker.IsLowMemoryDevice", |
(...skipping 21 matching lines...) Expand all Loading... |
64 jstring GetVersionNumber(JNIEnv* env, jclass clazz) { | 69 jstring GetVersionNumber(JNIEnv* env, jclass clazz) { |
65 return ConvertUTF8ToJavaString(env, g_library_version_number).Release(); | 70 return ConvertUTF8ToJavaString(env, g_library_version_number).Release(); |
66 } | 71 } |
67 | 72 |
68 static void RecordNativeLibraryHack(JNIEnv*, jclass, jboolean usedHack) { | 73 static void RecordNativeLibraryHack(JNIEnv*, jclass, jboolean usedHack) { |
69 UMA_HISTOGRAM_BOOLEAN("LibraryLoader.NativeLibraryHack", usedHack); | 74 UMA_HISTOGRAM_BOOLEAN("LibraryLoader.NativeLibraryHack", usedHack); |
70 } | 75 } |
71 | 76 |
72 } // namespace android | 77 } // namespace android |
73 } // namespace base | 78 } // namespace base |
OLD | NEW |