| 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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 const std::string& events_label, | 591 const std::string& events_label, |
| 592 const scoped_refptr<base::RefCountedString>& events_str_ptr) { | 592 const scoped_refptr<base::RefCountedString>& events_str_ptr) { |
| 593 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 593 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 594 | 594 |
| 595 if (trace_data_sink_.get() && events_str_ptr && | 595 if (trace_data_sink_.get() && events_str_ptr && |
| 596 !events_str_ptr->data().empty()) { | 596 !events_str_ptr->data().empty()) { |
| 597 if (agent_name == kETWTracingAgentName) { | 597 if (agent_name == kETWTracingAgentName) { |
| 598 // The Windows kernel events are kept into a JSON format stored as string | 598 // The Windows kernel events are kept into a JSON format stored as string |
| 599 // and must not be escaped. | 599 // and must not be escaped. |
| 600 trace_data_sink_->AddAgentTrace(events_label, events_str_ptr->data()); | 600 trace_data_sink_->AddAgentTrace(events_label, events_str_ptr->data()); |
| 601 } else if (agent_name != kArcTracingAgentName) { | 601 } else if (agent_name == kArcTracingAgentName) { |
| 602 // ARC trace data is obtained via systrace. Ignore the empty data. | 602 // The ARC events are kept into a JSON format stored as string |
| 603 // Quote other trace data as JSON strings and merge them into | 603 // and must not be escaped. |
| 604 // |trace_data_sink_|. | 604 trace_data_sink_->AddTraceChunk(events_str_ptr->data()); |
| 605 } else { |
| 605 trace_data_sink_->AddAgentTrace( | 606 trace_data_sink_->AddAgentTrace( |
| 606 events_label, base::GetQuotedJSONString(events_str_ptr->data())); | 607 events_label, base::GetQuotedJSONString(events_str_ptr->data())); |
| 607 } | 608 } |
| 608 } | 609 } |
| 609 std::vector<std::string> category_groups; | 610 std::vector<std::string> category_groups; |
| 610 OnStopTracingAcked(NULL, category_groups); | 611 OnStopTracingAcked(NULL, category_groups); |
| 611 } | 612 } |
| 612 | 613 |
| 613 void TracingControllerImpl::OnTraceDataCollected( | 614 void TracingControllerImpl::OnTraceDataCollected( |
| 614 const scoped_refptr<base::RefCountedString>& events_str_ptr) { | 615 const scoped_refptr<base::RefCountedString>& events_str_ptr) { |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 void TracingControllerImpl::RemoveTraceMessageFilterObserver( | 917 void TracingControllerImpl::RemoveTraceMessageFilterObserver( |
| 917 TraceMessageFilterObserver* observer) { | 918 TraceMessageFilterObserver* observer) { |
| 918 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 919 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 919 trace_message_filter_observers_.RemoveObserver(observer); | 920 trace_message_filter_observers_.RemoveObserver(observer); |
| 920 | 921 |
| 921 for (auto& filter : trace_message_filters_) | 922 for (auto& filter : trace_message_filters_) |
| 922 observer->OnTraceMessageFilterRemoved(filter.get()); | 923 observer->OnTraceMessageFilterRemoved(filter.get()); |
| 923 } | 924 } |
| 924 | 925 |
| 925 } // namespace content | 926 } // namespace content |
| OLD | NEW |