Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: content/app/android/library_loader_hooks.cc

Issue 1309243004: Reland again [Startup Tracing] Add --trace-config-file flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/tracing_nacl.gyp ('k') | content/app/content_main_runner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/startup_tracing.h" 19 #include "components/tracing/trace_config_file.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
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 tracing::EnableStartupTracingIfConfigFileExists(); 97 if (tracing::TraceConfigFile::GetInstance()->IsEnabled()) {
98 base::trace_event::TraceLog::GetInstance()->SetEnabled(
99 tracing::TraceConfigFile::GetInstance()->GetTraceConfig(),
100 base::trace_event::TraceLog::RECORDING_MODE);
101 }
98 } 102 }
99 103
100 // Android's main browser loop is custom so we set the browser 104 // Android's main browser loop is custom so we set the browser
101 // name here as early as possible. 105 // name here as early as possible.
102 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); 106 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, "");
103 base::trace_event::TraceLog::GetInstance()->SetProcessName("Browser"); 107 base::trace_event::TraceLog::GetInstance()->SetProcessName("Browser");
104 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( 108 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex(
105 kTraceEventBrowserProcessSortIndex); 109 kTraceEventBrowserProcessSortIndex);
106 110
107 // Can only use event tracing after setting up the command line. 111 // Can only use event tracing after setting up the command line.
108 TRACE_EVENT0("jni", "JNI_OnLoad continuation"); 112 TRACE_EVENT0("jni", "JNI_OnLoad continuation");
109 113
110 logging::LoggingSettings settings; 114 logging::LoggingSettings settings;
111 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 115 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
112 logging::InitLogging(settings); 116 logging::InitLogging(settings);
113 // To view log output with IDs and timestamps use "adb logcat -v threadtime". 117 // To view log output with IDs and timestamps use "adb logcat -v threadtime".
114 logging::SetLogItems(false, // Process ID 118 logging::SetLogItems(false, // Process ID
115 false, // Thread ID 119 false, // Thread ID
116 false, // Timestamp 120 false, // Timestamp
117 false); // Tick count 121 false); // Tick count
118 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel() 122 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel()
119 << ", default verbosity = " << logging::GetVlogVerbosity(); 123 << ", default verbosity = " << logging::GetVlogVerbosity();
120 124
121 return true; 125 return true;
122 } 126 }
123 127
124 } // namespace content 128 } // namespace content
OLDNEW
« no previous file with comments | « components/tracing_nacl.gyp ('k') | content/app/content_main_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698