| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/public/app/android_library_loader_hooks.h" | 5 #include "content/public/app/android_library_loader_hooks.h" |
| 6 | 6 |
| 7 #include "base/android/base_jni_registrar.h" | 7 #include "base/android/base_jni_registrar.h" |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_registrar.h" | 9 #include "base/android/jni_registrar.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
| 12 #include "base/base_switches.h" | 12 #include "base/base_switches.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/metrics/histogram.h" |
| 17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 18 #include "base/tracked_objects.h" | 19 #include "base/tracked_objects.h" |
| 19 #include "content/app/android/app_jni_registrar.h" | 20 #include "content/app/android/app_jni_registrar.h" |
| 20 #include "content/browser/android/browser_jni_registrar.h" | 21 #include "content/browser/android/browser_jni_registrar.h" |
| 21 #include "content/child/android/child_jni_registrar.h" | 22 #include "content/child/android/child_jni_registrar.h" |
| 22 #include "content/common/android/command_line.h" | 23 #include "content/common/android/command_line.h" |
| 23 #include "content/common/android/common_jni_registrar.h" | 24 #include "content/common/android/common_jni_registrar.h" |
| 24 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 25 #include "content/public/common/result_codes.h" | 26 #include "content/public/common/result_codes.h" |
| 26 #include "jni/LibraryLoader_jni.h" | 27 #include "jni/LibraryLoader_jni.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 101 |
| 101 if (!content::android::RegisterAppJni(env)) | 102 if (!content::android::RegisterAppJni(env)) |
| 102 return RESULT_CODE_FAILED_TO_REGISTER_JNI; | 103 return RESULT_CODE_FAILED_TO_REGISTER_JNI; |
| 103 | 104 |
| 104 if (!media::RegisterJni(env)) | 105 if (!media::RegisterJni(env)) |
| 105 return RESULT_CODE_FAILED_TO_REGISTER_JNI; | 106 return RESULT_CODE_FAILED_TO_REGISTER_JNI; |
| 106 | 107 |
| 107 return 0; | 108 return 0; |
| 108 } | 109 } |
| 109 | 110 |
| 111 static void RecordContentAndroidLinkerHistogram( |
| 112 JNIEnv* env, |
| 113 jclass clazz, |
| 114 jboolean loaded_at_fixed_address_failed, |
| 115 jboolean is_low_memory_device) { |
| 116 UMA_HISTOGRAM_BOOLEAN("ContentAndroidLinker.LoadedAtFixedAddressFailed", |
| 117 loaded_at_fixed_address_failed); |
| 118 UMA_HISTOGRAM_BOOLEAN("ContentAndroidLinker.IsLowMemoryDevice", |
| 119 is_low_memory_device); |
| 120 } |
| 121 |
| 110 void LibraryLoaderExitHook() { | 122 void LibraryLoaderExitHook() { |
| 111 if (g_at_exit_manager) { | 123 if (g_at_exit_manager) { |
| 112 delete g_at_exit_manager; | 124 delete g_at_exit_manager; |
| 113 g_at_exit_manager = NULL; | 125 g_at_exit_manager = NULL; |
| 114 } | 126 } |
| 115 } | 127 } |
| 116 | 128 |
| 117 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { | 129 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { |
| 118 // We need the AtExitManager to be created at the very beginning. | 130 // We need the AtExitManager to be created at the very beginning. |
| 119 g_at_exit_manager = new base::AtExitManager(); | 131 g_at_exit_manager = new base::AtExitManager(); |
| 120 | 132 |
| 121 return RegisterNativesImpl(env); | 133 return RegisterNativesImpl(env); |
| 122 } | 134 } |
| 123 | 135 |
| 124 } // namespace content | 136 } // namespace content |
| OLD | NEW |