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" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 #include "net/android/net_jni_registrar.h" | 28 #include "net/android/net_jni_registrar.h" |
29 #include "ui/android/ui_jni_registrar.h" | 29 #include "ui/android/ui_jni_registrar.h" |
30 #include "ui/shell_dialogs/android/shell_dialogs_jni_registrar.h" | 30 #include "ui/shell_dialogs/android/shell_dialogs_jni_registrar.h" |
31 | 31 |
32 namespace { | 32 namespace { |
33 base::AtExitManager* g_at_exit_manager = NULL; | 33 base::AtExitManager* g_at_exit_manager = NULL; |
34 } | 34 } |
35 | 35 |
36 namespace content { | 36 namespace content { |
37 | 37 |
38 static jint LibraryLoadedOnMainThread(JNIEnv* env, jclass clazz, | 38 static jint LibraryLoaded(JNIEnv* env, jclass clazz, |
39 jobjectArray init_command_line) { | 39 jobjectArray init_command_line) { |
40 InitNativeCommandLineFromJavaArray(env, init_command_line); | 40 InitNativeCommandLineFromJavaArray(env, init_command_line); |
41 | 41 |
42 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 42 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
43 | 43 |
44 if (command_line->HasSwitch(switches::kTraceStartup)) { | 44 if (command_line->HasSwitch(switches::kTraceStartup)) { |
45 base::debug::TraceLog::GetInstance()->SetEnabled( | 45 base::debug::TraceLog::GetInstance()->SetEnabled( |
46 command_line->GetSwitchValueASCII(switches::kTraceStartup), | 46 command_line->GetSwitchValueASCII(switches::kTraceStartup), |
47 base::debug::TraceLog::RECORD_UNTIL_FULL); | 47 base::debug::TraceLog::RECORD_UNTIL_FULL); |
48 } | 48 } |
49 | 49 |
50 // Can only use event tracing after setting up the command line. | 50 // Can only use event tracing after setting up the command line. |
51 TRACE_EVENT0("jni", "JNI_OnLoad continuation"); | 51 TRACE_EVENT0("jni", "JNI_OnLoad continuation"); |
52 | 52 |
53 // Note: because logging is setup here right after copying the command line | 53 // Note: because logging is setup here right after copying the command line |
54 // array from java to native up top of this method, any code that adds the | 54 // array from java to native up top of this method, any code that adds the |
55 // --enable-dcheck switch must do so on the Java side. | 55 // --enable-dcheck switch must do so on the Java side. |
56 logging::DcheckState dcheck_state = | 56 logging::DcheckState dcheck_state = |
57 command_line->HasSwitch(switches::kEnableDCHECK) ? | 57 command_line->HasSwitch(switches::kEnableDCHECK) ? |
58 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS : | 58 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS : |
59 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; | 59 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; |
60 logging::InitLogging(NULL, | 60 logging::InitLogging(NULL, |
joth
2013/03/18 16:32:55
internally this calls LoggingLock::Init which has
aberent
2013/03/18 18:44:54
As I understand the code it does mean 'a single th
| |
61 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 61 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
62 logging::DONT_LOCK_LOG_FILE, | 62 logging::DONT_LOCK_LOG_FILE, |
63 logging::DELETE_OLD_LOG_FILE, | 63 logging::DELETE_OLD_LOG_FILE, |
64 dcheck_state); | 64 dcheck_state); |
65 // To view log output with IDs and timestamps use "adb logcat -v threadtime". | 65 // To view log output with IDs and timestamps use "adb logcat -v threadtime". |
66 logging::SetLogItems(false, // Process ID | 66 logging::SetLogItems(false, // Process ID |
67 false, // Thread ID | 67 false, // Thread ID |
68 false, // Timestamp | 68 false, // Timestamp |
69 false); // Tick count | 69 false); // Tick count |
70 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel() | 70 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel() |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 } | 105 } |
106 | 106 |
107 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { | 107 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { |
108 // We need the AtExitManager to be created at the very beginning. | 108 // We need the AtExitManager to be created at the very beginning. |
109 g_at_exit_manager = new base::AtExitManager(); | 109 g_at_exit_manager = new base::AtExitManager(); |
110 | 110 |
111 return RegisterNativesImpl(env); | 111 return RegisterNativesImpl(env); |
112 } | 112 } |
113 | 113 |
114 } // namespace content | 114 } // namespace content |
OLD | NEW |