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

Side by Side Diff: content/browser/tracing/tracing_controller_impl.cc

Issue 1638443003: tracing_controller: Eliminates extra parameter of StartAgentTracingDone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « content/browser/tracing/tracing_controller_impl.h ('k') | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "content/browser/tracing/tracing_controller_impl.h" 4 #include "content/browser/tracing/tracing_controller_impl.h"
5 5
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/cpu.h" 7 #include "base/cpu.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/json/string_escape.h" 9 #include "base/json/string_escape.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 #endif 245 #endif
246 } 246 }
247 247
248 // TraceLog may have been enabled in startup tracing before threads are ready. 248 // TraceLog may have been enabled in startup tracing before threads are ready.
249 if (TraceLog::GetInstance()->IsEnabled()) 249 if (TraceLog::GetInstance()->IsEnabled())
250 return true; 250 return true;
251 return StartAgentTracing(trace_config); 251 return StartAgentTracing(trace_config);
252 } 252 }
253 253
254 void TracingControllerImpl::OnStartAgentTracingDone( 254 void TracingControllerImpl::OnStartAgentTracingDone(
255 const TraceConfig& trace_config, 255 const TraceConfig& trace_config) {
256 const StartTracingDoneCallback& callback) {
257 DCHECK_CURRENTLY_ON(BrowserThread::UI); 256 DCHECK_CURRENTLY_ON(BrowserThread::UI);
258 257
259 TRACE_EVENT_API_ADD_METADATA_EVENT("IsTimeTicksHighResolution", "value", 258 TRACE_EVENT_API_ADD_METADATA_EVENT("IsTimeTicksHighResolution", "value",
260 base::TimeTicks::IsHighResolution()); 259 base::TimeTicks::IsHighResolution());
261 TRACE_EVENT_API_ADD_METADATA_EVENT("TraceConfig", "value", 260 TRACE_EVENT_API_ADD_METADATA_EVENT("TraceConfig", "value",
262 trace_config.AsConvertableToTraceFormat()); 261 trace_config.AsConvertableToTraceFormat());
263 262
264 // Notify all child processes. 263 // Notify all child processes.
265 for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); 264 for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin();
266 it != trace_message_filters_.end(); ++it) { 265 it != trace_message_filters_.end(); ++it) {
267 it->get()->SendBeginTracing(trace_config); 266 it->get()->SendBeginTracing(trace_config);
268 } 267 }
269 268
270 if (!callback.is_null()) 269 if (!start_tracing_done_callback_.is_null()) {
271 callback.Run(); 270 start_tracing_done_callback_.Run();
272 271 start_tracing_done_callback_.Reset();
273 start_tracing_done_callback_.Reset(); 272 }
274 } 273 }
275 274
276 bool TracingControllerImpl::StopTracing( 275 bool TracingControllerImpl::StopTracing(
277 const scoped_refptr<TraceDataSink>& trace_data_sink) { 276 const scoped_refptr<TraceDataSink>& trace_data_sink) {
278 DCHECK_CURRENTLY_ON(BrowserThread::UI); 277 DCHECK_CURRENTLY_ON(BrowserThread::UI);
279 278
280 if (trace_data_sink) { 279 if (trace_data_sink) {
281 if (TraceLog::GetInstance()->GetCurrentTraceConfig() 280 if (TraceLog::GetInstance()->GetCurrentTraceConfig()
282 .IsArgumentFilterEnabled()) { 281 .IsArgumentFilterEnabled()) {
283 scoped_ptr<TracingDelegate> delegate( 282 scoped_ptr<TracingDelegate> delegate(
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 std::string TracingControllerImpl::GetTraceEventLabel() { 875 std::string TracingControllerImpl::GetTraceEventLabel() {
877 return kChromeTraceLabel; 876 return kChromeTraceLabel;
878 } 877 }
879 878
880 bool TracingControllerImpl::StartAgentTracing( 879 bool TracingControllerImpl::StartAgentTracing(
881 const base::trace_event::TraceConfig& trace_config) { 880 const base::trace_event::TraceConfig& trace_config) {
882 DCHECK_CURRENTLY_ON(BrowserThread::UI); 881 DCHECK_CURRENTLY_ON(BrowserThread::UI);
883 882
884 base::Closure on_start_tracing_done_callback = 883 base::Closure on_start_tracing_done_callback =
885 base::Bind(&TracingControllerImpl::OnStartAgentTracingDone, 884 base::Bind(&TracingControllerImpl::OnStartAgentTracingDone,
886 base::Unretained(this), 885 base::Unretained(this), trace_config);
887 trace_config, start_tracing_done_callback_);
888 if (!BrowserThread::PostTask( 886 if (!BrowserThread::PostTask(
889 BrowserThread::FILE, FROM_HERE, 887 BrowserThread::FILE, FROM_HERE,
890 base::Bind(&TracingControllerImpl::SetEnabledOnFileThread, 888 base::Bind(&TracingControllerImpl::SetEnabledOnFileThread,
891 base::Unretained(this), trace_config, 889 base::Unretained(this), trace_config,
892 base::trace_event::TraceLog::RECORDING_MODE, 890 base::trace_event::TraceLog::RECORDING_MODE,
893 on_start_tracing_done_callback))) { 891 on_start_tracing_done_callback))) {
894 // BrowserThread::PostTask fails if the threads haven't been created yet, 892 // BrowserThread::PostTask fails if the threads haven't been created yet,
895 // so it should be safe to just use TraceLog::SetEnabled directly. 893 // so it should be safe to just use TraceLog::SetEnabled directly.
896 base::trace_event::TraceLog::GetInstance()->SetEnabled( 894 base::trace_event::TraceLog::GetInstance()->SetEnabled(
897 trace_config, base::trace_event::TraceLog::RECORDING_MODE); 895 trace_config, base::trace_event::TraceLog::RECORDING_MODE);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 is_monitoring_ = is_monitoring; 1123 is_monitoring_ = is_monitoring;
1126 #if !defined(OS_ANDROID) 1124 #if !defined(OS_ANDROID)
1127 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); 1125 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin();
1128 it != tracing_uis_.end(); it++) { 1126 it != tracing_uis_.end(); it++) {
1129 (*it)->OnMonitoringStateChanged(is_monitoring); 1127 (*it)->OnMonitoringStateChanged(is_monitoring);
1130 } 1128 }
1131 #endif 1129 #endif
1132 } 1130 }
1133 1131
1134 } // namespace content 1132 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/tracing/tracing_controller_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698