Chromium Code Reviews| 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_registrar.h" | 8 #include "base/android/jni_registrar.h" |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 #include "media/base/android/media_jni_registrar.h" | 25 #include "media/base/android/media_jni_registrar.h" |
| 26 #include "net/android/net_jni_registrar.h" | 26 #include "net/android/net_jni_registrar.h" |
| 27 #include "jni/library_loader_jni.h" | 27 #include "jni/library_loader_jni.h" |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 base::AtExitManager* g_at_exit_manager = NULL; | 30 base::AtExitManager* g_at_exit_manager = NULL; |
| 31 } | 31 } |
| 32 | 32 |
| 33 jboolean LibraryLoadedOnMainThread(JNIEnv* env, jclass clazz, | 33 jboolean LibraryLoadedOnMainThread(JNIEnv* env, jclass clazz, |
| 34 jobjectArray init_command_line) { | 34 jobjectArray init_command_line) { |
| 35 // We need the Chrome AtExitManager to be created before we do any tracing or | |
| 36 // logging. | |
| 37 g_at_exit_manager = new base::AtExitManager(); | |
| 38 InitNativeCommandLineFromJavaArray(env, init_command_line); | 35 InitNativeCommandLineFromJavaArray(env, init_command_line); |
| 39 | 36 |
| 40 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 37 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 41 | 38 |
| 42 if (command_line->HasSwitch(switches::kTraceStartup)) { | 39 if (command_line->HasSwitch(switches::kTraceStartup)) { |
| 43 base::debug::TraceLog::GetInstance()->SetEnabled( | 40 base::debug::TraceLog::GetInstance()->SetEnabled( |
| 44 command_line->GetSwitchValueASCII(switches::kTraceStartup)); | 41 command_line->GetSwitchValueASCII(switches::kTraceStartup)); |
| 45 } | 42 } |
| 46 | 43 |
| 47 // Can only use event tracing after setting up the command line. | 44 // Can only use event tracing after setting up the command line. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 namespace content { | 81 namespace content { |
| 85 | 82 |
| 86 void LibraryLoaderExitHook() { | 83 void LibraryLoaderExitHook() { |
| 87 if (g_at_exit_manager) { | 84 if (g_at_exit_manager) { |
| 88 delete g_at_exit_manager; | 85 delete g_at_exit_manager; |
| 89 g_at_exit_manager = NULL; | 86 g_at_exit_manager = NULL; |
| 90 } | 87 } |
| 91 } | 88 } |
| 92 | 89 |
| 93 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { | 90 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { |
| 91 // We need the Chrome AtExitManager to be created at the very beginning. | |
|
jam
2012/07/10 23:52:35
nit: drop the "Chrome"
michaelbai
2012/07/11 00:18:09
Done.
| |
| 92 g_at_exit_manager = new base::AtExitManager(); | |
| 93 | |
| 94 return RegisterNativesImpl(env); | 94 return RegisterNativesImpl(env); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace content | 97 } // namespace content |
| OLD | NEW |