OLD | NEW |
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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 } | 677 } |
678 | 678 |
679 void TracingControllerImpl::OnEndAgentTracingAcked( | 679 void TracingControllerImpl::OnEndAgentTracingAcked( |
680 const std::string& agent_name, | 680 const std::string& agent_name, |
681 const std::string& events_label, | 681 const std::string& events_label, |
682 const scoped_refptr<base::RefCountedString>& events_str_ptr) { | 682 const scoped_refptr<base::RefCountedString>& events_str_ptr) { |
683 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 683 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
684 | 684 |
685 if (trace_data_sink_.get() && events_str_ptr && | 685 if (trace_data_sink_.get() && events_str_ptr && |
686 !events_str_ptr->data().empty()) { | 686 !events_str_ptr->data().empty()) { |
687 if (agent_name == kETWTracingAgentName) { | 687 std::string json_string; |
688 // The Windows kernel events are kept into a JSON format stored as string | 688 if (agent_name == kETWTracingAgentName || |
689 // and must not be escaped. | 689 agent_name == kArcTracingAgentName) { |
690 trace_data_sink_->AddAgentTrace(events_label, events_str_ptr->data()); | 690 // The Windows kernel events and ARC Android tracing event are kept |
691 } else if (agent_name != kArcTracingAgentName) { | 691 // into a JSON format stored as string and must not be escaped. |
692 // ARC trace data is obtained via systrace. Ignore the empty data. | 692 json_string = events_str_ptr->data(); |
693 // Quote other trace data as JSON strings and merge them into | 693 } else { |
694 // |trace_data_sink_|. | 694 json_string = base::GetQuotedJSONString(events_str_ptr->data()); |
695 trace_data_sink_->AddAgentTrace( | 695 } |
696 events_label, base::GetQuotedJSONString(events_str_ptr->data())); | 696 |
| 697 if (agent_name == kArcTracingAgentName) { |
| 698 trace_data_sink_->AddTraceChunk(json_string); |
| 699 } else { |
| 700 trace_data_sink_->AddAgentTrace(events_label, json_string); |
697 } | 701 } |
698 } | 702 } |
699 std::vector<std::string> category_groups; | 703 std::vector<std::string> category_groups; |
700 OnStopTracingAcked(NULL, category_groups); | 704 OnStopTracingAcked(NULL, category_groups); |
701 } | 705 } |
702 | 706 |
703 void TracingControllerImpl::OnTraceDataCollected( | 707 void TracingControllerImpl::OnTraceDataCollected( |
704 const scoped_refptr<base::RefCountedString>& events_str_ptr) { | 708 const scoped_refptr<base::RefCountedString>& events_str_ptr) { |
705 // OnTraceDataCollected may be called from any browser thread, either by the | 709 // OnTraceDataCollected may be called from any browser thread, either by the |
706 // local event trace system or from child processes via TraceMessageFilter. | 710 // local event trace system or from child processes via TraceMessageFilter. |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 // Schedule the next queued dump (if applicable). | 1084 // Schedule the next queued dump (if applicable). |
1081 if (!queued_memory_dump_requests_.empty()) { | 1085 if (!queued_memory_dump_requests_.empty()) { |
1082 BrowserThread::PostTask( | 1086 BrowserThread::PostTask( |
1083 BrowserThread::UI, FROM_HERE, | 1087 BrowserThread::UI, FROM_HERE, |
1084 base::Bind(&TracingControllerImpl::PerformNextQueuedGlobalMemoryDump, | 1088 base::Bind(&TracingControllerImpl::PerformNextQueuedGlobalMemoryDump, |
1085 base::Unretained(this))); | 1089 base::Unretained(this))); |
1086 } | 1090 } |
1087 } | 1091 } |
1088 | 1092 |
1089 } // namespace content | 1093 } // namespace content |
OLD | NEW |