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/app/android/library_loader_hooks.h" | 5 #include "content/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/command_line_android.h" | 8 #include "base/android/command_line_android.h" |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_registrar.h" | 10 #include "base/android/jni_registrar.h" |
11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.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/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
18 #include "base/tracked_objects.h" | 18 #include "base/tracked_objects.h" |
19 #include "components/tracing/trace_config_file.h" | 19 #include "components/tracing/startup_tracing.h" |
20 #include "components/tracing/tracing_switches.h" | 20 #include "components/tracing/tracing_switches.h" |
21 #include "content/app/android/app_jni_registrar.h" | 21 #include "content/app/android/app_jni_registrar.h" |
22 #include "content/browser/android/browser_jni_registrar.h" | 22 #include "content/browser/android/browser_jni_registrar.h" |
23 #include "content/common/android/common_jni_registrar.h" | 23 #include "content/common/android/common_jni_registrar.h" |
24 #include "content/common/content_constants_internal.h" | 24 #include "content/common/content_constants_internal.h" |
25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
26 #include "content/public/common/result_codes.h" | 26 #include "content/public/common/result_codes.h" |
27 #include "device/bluetooth/android/bluetooth_jni_registrar.h" | 27 #include "device/bluetooth/android/bluetooth_jni_registrar.h" |
28 #include "media/base/android/media_jni_registrar.h" | 28 #include "media/base/android/media_jni_registrar.h" |
29 #include "media/midi/midi_jni_registrar.h" | 29 #include "media/midi/midi_jni_registrar.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 bool LibraryLoaded(JNIEnv* env, jclass clazz) { | 88 bool LibraryLoaded(JNIEnv* env, jclass clazz) { |
89 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 89 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
90 | 90 |
91 if (command_line->HasSwitch(switches::kTraceStartup)) { | 91 if (command_line->HasSwitch(switches::kTraceStartup)) { |
92 base::trace_event::TraceConfig trace_config( | 92 base::trace_event::TraceConfig trace_config( |
93 command_line->GetSwitchValueASCII(switches::kTraceStartup), ""); | 93 command_line->GetSwitchValueASCII(switches::kTraceStartup), ""); |
94 base::trace_event::TraceLog::GetInstance()->SetEnabled( | 94 base::trace_event::TraceLog::GetInstance()->SetEnabled( |
95 trace_config, base::trace_event::TraceLog::RECORDING_MODE); | 95 trace_config, base::trace_event::TraceLog::RECORDING_MODE); |
96 } else { | 96 } else { |
97 if (tracing::TraceConfigFile::GetInstance()->IsEnabled()) { | 97 tracing::EnableStartupTracingIfConfigFileExists(); |
98 base::trace_event::TraceLog::GetInstance()->SetEnabled( | |
99 tracing::TraceConfigFile::GetInstance()->GetTraceConfig(), | |
100 base::trace_event::TraceLog::RECORDING_MODE); | |
101 } | |
102 } | 98 } |
103 | 99 |
104 // Android's main browser loop is custom so we set the browser | 100 // Android's main browser loop is custom so we set the browser |
105 // name here as early as possible. | 101 // name here as early as possible. |
106 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); | 102 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); |
107 base::trace_event::TraceLog::GetInstance()->SetProcessName("Browser"); | 103 base::trace_event::TraceLog::GetInstance()->SetProcessName("Browser"); |
108 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( | 104 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( |
109 kTraceEventBrowserProcessSortIndex); | 105 kTraceEventBrowserProcessSortIndex); |
110 | 106 |
111 // Can only use event tracing after setting up the command line. | 107 // Can only use event tracing after setting up the command line. |
112 TRACE_EVENT0("jni", "JNI_OnLoad continuation"); | 108 TRACE_EVENT0("jni", "JNI_OnLoad continuation"); |
113 | 109 |
114 logging::LoggingSettings settings; | 110 logging::LoggingSettings settings; |
115 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 111 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
116 logging::InitLogging(settings); | 112 logging::InitLogging(settings); |
117 // To view log output with IDs and timestamps use "adb logcat -v threadtime". | 113 // To view log output with IDs and timestamps use "adb logcat -v threadtime". |
118 logging::SetLogItems(false, // Process ID | 114 logging::SetLogItems(false, // Process ID |
119 false, // Thread ID | 115 false, // Thread ID |
120 false, // Timestamp | 116 false, // Timestamp |
121 false); // Tick count | 117 false); // Tick count |
122 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel() | 118 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel() |
123 << ", default verbosity = " << logging::GetVlogVerbosity(); | 119 << ", default verbosity = " << logging::GetVlogVerbosity(); |
124 | 120 |
125 return true; | 121 return true; |
126 } | 122 } |
127 | 123 |
128 } // namespace content | 124 } // namespace content |
OLD | NEW |