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

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

Issue 2867693004: Snapshot of all changes to get jumbo in blink and content.
Patch Set: Exclude certain files from jumbo because of a Windows problem Created 3 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
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 <algorithm> 6 #include <algorithm>
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "content/browser/tracing/etw_tracing_agent_win.h" 59 #include "content/browser/tracing/etw_tracing_agent_win.h"
60 #endif 60 #endif
61 61
62 using base::trace_event::TraceLog; 62 using base::trace_event::TraceLog;
63 using base::trace_event::TraceConfig; 63 using base::trace_event::TraceConfig;
64 64
65 namespace content { 65 namespace content {
66 66
67 namespace { 67 namespace {
68 68
69 base::LazyInstance<TracingControllerImpl>::Leaky g_controller = 69 base::LazyInstance<TracingControllerImpl>::Leaky g_tracing_controller =
70 LAZY_INSTANCE_INITIALIZER; 70 LAZY_INSTANCE_INITIALIZER;
71 71
72 const char kChromeTracingAgentName[] = "chrome"; 72 const char kChromeTracingAgentName[] = "chrome";
73 const char kETWTracingAgentName[] = "etw"; 73 const char kETWTracingAgentNameCopy[] = "etw";
74 const char kArcTracingAgentName[] = "arc"; 74 const char kArcTracingAgentNameCopy[] = "arc";
75 const char kChromeTraceLabel[] = "traceEvents"; 75 const char kChromeTraceLabel[] = "traceEvents";
76 76
77 const int kStartTracingTimeoutSeconds = 30; 77 const int kStartTracingTimeoutSeconds = 30;
78 const int kIssueClockSyncTimeoutSeconds = 30; 78 const int kIssueClockSyncTimeoutSeconds = 30;
79 const int kStopTracingRetryTimeMilliseconds = 100; 79 const int kStopTracingRetryTimeMilliseconds = 100;
80 80
81 std::string GetNetworkTypeString() { 81 std::string GetNetworkTypeString() {
82 switch (net::NetworkChangeNotifier::GetConnectionType()) { 82 switch (net::NetworkChangeNotifier::GetConnectionType()) {
83 case net::NetworkChangeNotifier::CONNECTION_ETHERNET: 83 case net::NetworkChangeNotifier::CONNECTION_ETHERNET:
84 return "Ethernet"; 84 return "Ethernet";
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // Deliberately leaked, like this class. 138 // Deliberately leaked, like this class.
139 base::FileTracing::SetProvider(new FileTracingProviderImpl); 139 base::FileTracing::SetProvider(new FileTracingProviderImpl);
140 } 140 }
141 141
142 TracingControllerImpl::~TracingControllerImpl() { 142 TracingControllerImpl::~TracingControllerImpl() {
143 // This is a Leaky instance. 143 // This is a Leaky instance.
144 NOTREACHED(); 144 NOTREACHED();
145 } 145 }
146 146
147 TracingControllerImpl* TracingControllerImpl::GetInstance() { 147 TracingControllerImpl* TracingControllerImpl::GetInstance() {
148 return g_controller.Pointer(); 148 return g_tracing_controller.Pointer();
149 } 149 }
150 150
151 bool TracingControllerImpl::GetCategories( 151 bool TracingControllerImpl::GetCategories(
152 const GetCategoriesDoneCallback& callback) { 152 const GetCategoriesDoneCallback& callback) {
153 DCHECK_CURRENTLY_ON(BrowserThread::UI); 153 DCHECK_CURRENTLY_ON(BrowserThread::UI);
154 154
155 // Known categories come back from child processes with the EndTracingAck 155 // Known categories come back from child processes with the EndTracingAck
156 // message. So to get known categories, just begin and end tracing immediately 156 // message. So to get known categories, just begin and end tracing immediately
157 // afterwards. This will ping all the child processes for categories. 157 // afterwards. This will ping all the child processes for categories.
158 pending_get_categories_done_callback_ = callback; 158 pending_get_categories_done_callback_ = callback;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 #if defined(OS_CHROMEOS) 454 #if defined(OS_CHROMEOS)
455 auto* debug_daemon = 455 auto* debug_daemon =
456 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); 456 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient();
457 if (agent_name == debug_daemon->GetTracingAgentName()) { 457 if (agent_name == debug_daemon->GetTracingAgentName()) {
458 additional_tracing_agents_.push_back(debug_daemon); 458 additional_tracing_agents_.push_back(debug_daemon);
459 debug_daemon->SetStopAgentTracingTaskRunner( 459 debug_daemon->SetStopAgentTracingTaskRunner(
460 BrowserThread::GetBlockingPool()); 460 BrowserThread::GetBlockingPool());
461 return; 461 return;
462 } 462 }
463 463
464 if (agent_name == kArcTracingAgentName) { 464 if (agent_name == kArcTracingAgentNameCopy) {
465 additional_tracing_agents_.push_back(ArcTracingAgent::GetInstance()); 465 additional_tracing_agents_.push_back(ArcTracingAgent::GetInstance());
466 return; 466 return;
467 } 467 }
468 #elif defined(OS_WIN) 468 #elif defined(OS_WIN)
469 auto* etw_agent = EtwTracingAgent::GetInstance(); 469 auto* etw_agent = EtwTracingAgent::GetInstance();
470 if (agent_name == etw_agent->GetTracingAgentName()) { 470 if (agent_name == etw_agent->GetTracingAgentName()) {
471 additional_tracing_agents_.push_back(etw_agent); 471 additional_tracing_agents_.push_back(etw_agent);
472 return; 472 return;
473 } 473 }
474 #endif 474 #endif
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 } 562 }
563 563
564 void TracingControllerImpl::OnEndAgentTracingAcked( 564 void TracingControllerImpl::OnEndAgentTracingAcked(
565 const std::string& agent_name, 565 const std::string& agent_name,
566 const std::string& events_label, 566 const std::string& events_label,
567 const scoped_refptr<base::RefCountedString>& events_str_ptr) { 567 const scoped_refptr<base::RefCountedString>& events_str_ptr) {
568 DCHECK_CURRENTLY_ON(BrowserThread::UI); 568 DCHECK_CURRENTLY_ON(BrowserThread::UI);
569 569
570 if (trace_data_sink_.get() && events_str_ptr && 570 if (trace_data_sink_.get() && events_str_ptr &&
571 !events_str_ptr->data().empty()) { 571 !events_str_ptr->data().empty()) {
572 if (agent_name == kETWTracingAgentName) { 572 if (agent_name == kETWTracingAgentNameCopy) {
573 // The Windows kernel events are kept into a JSON format stored as string 573 // The Windows kernel events are kept into a JSON format stored as string
574 // and must not be escaped. 574 // and must not be escaped.
575 trace_data_sink_->AddAgentTrace(events_label, events_str_ptr->data()); 575 trace_data_sink_->AddAgentTrace(events_label, events_str_ptr->data());
576 } else if (agent_name == kArcTracingAgentName) { 576 } else if (agent_name == kArcTracingAgentNameCopy) {
577 // The ARC events are kept into a JSON format stored as string 577 // The ARC events are kept into a JSON format stored as string
578 // and must not be escaped. 578 // and must not be escaped.
579 trace_data_sink_->AddTraceChunk(events_str_ptr->data()); 579 trace_data_sink_->AddTraceChunk(events_str_ptr->data());
580 } else { 580 } else {
581 trace_data_sink_->AddAgentTrace( 581 trace_data_sink_->AddAgentTrace(
582 events_label, base::GetQuotedJSONString(events_str_ptr->data())); 582 events_label, base::GetQuotedJSONString(events_str_ptr->data()));
583 } 583 }
584 } 584 }
585 std::vector<std::string> category_groups; 585 std::vector<std::string> category_groups;
586 OnStopTracingAcked(NULL, category_groups); 586 OnStopTracingAcked(NULL, category_groups);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 base::Time::Now().UTCExplode(&ctime); 890 base::Time::Now().UTCExplode(&ctime);
891 std::string time_string = base::StringPrintf( 891 std::string time_string = base::StringPrintf(
892 "%u-%u-%u %d:%d:%d", ctime.year, ctime.month, ctime.day_of_month, 892 "%u-%u-%u %d:%d:%d", ctime.year, ctime.month, ctime.day_of_month,
893 ctime.hour, ctime.minute, ctime.second); 893 ctime.hour, ctime.minute, ctime.second);
894 metadata_dict->SetString("trace-capture-datetime", time_string); 894 metadata_dict->SetString("trace-capture-datetime", time_string);
895 895
896 return metadata_dict; 896 return metadata_dict;
897 } 897 }
898 898
899 } // namespace content 899 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/speech/endpointer/endpointer.cc ('k') | content/browser/tracing/tracing_controller_impl_data_sinks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698