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

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

Issue 2400163003: arc: enable Android tracing in verified-boot mode (Closed)
Patch Set: Address comments Created 3 years, 8 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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 } 661 }
662 662
663 void TracingControllerImpl::OnEndAgentTracingAcked( 663 void TracingControllerImpl::OnEndAgentTracingAcked(
664 const std::string& agent_name, 664 const std::string& agent_name,
665 const std::string& events_label, 665 const std::string& events_label,
666 const scoped_refptr<base::RefCountedString>& events_str_ptr) { 666 const scoped_refptr<base::RefCountedString>& events_str_ptr) {
667 DCHECK_CURRENTLY_ON(BrowserThread::UI); 667 DCHECK_CURRENTLY_ON(BrowserThread::UI);
668 668
669 if (trace_data_sink_.get() && events_str_ptr && 669 if (trace_data_sink_.get() && events_str_ptr &&
670 !events_str_ptr->data().empty()) { 670 !events_str_ptr->data().empty()) {
671 if (agent_name == kETWTracingAgentName) { 671 std::string json_string;
672 // The Windows kernel events are kept into a JSON format stored as string 672 if (agent_name == kETWTracingAgentName ||
673 // and must not be escaped. 673 agent_name == kArcTracingAgentName) {
674 trace_data_sink_->AddAgentTrace(events_label, events_str_ptr->data()); 674 // The Windows kernel events and ARC Android tracing event are kept
675 } else if (agent_name != kArcTracingAgentName) { 675 // into a JSON format stored as string and must not be escaped.
676 // ARC trace data is obtained via systrace. Ignore the empty data. 676 json_string = events_str_ptr->data();
dcheng 2017/04/06 06:14:14 This copies the data string at least 2x now for Wi
shunhsingou 2017/04/06 08:42:28 Done.
677 // Quote other trace data as JSON strings and merge them into 677 } else {
678 // |trace_data_sink_|. 678 json_string = base::GetQuotedJSONString(events_str_ptr->data());
679 trace_data_sink_->AddAgentTrace( 679 }
680 events_label, base::GetQuotedJSONString(events_str_ptr->data())); 680
681 if (agent_name == kArcTracingAgentName) {
682 trace_data_sink_->AddTraceChunk(json_string);
683 } else {
684 trace_data_sink_->AddAgentTrace(events_label, json_string);
681 } 685 }
682 } 686 }
683 std::vector<std::string> category_groups; 687 std::vector<std::string> category_groups;
684 OnStopTracingAcked(NULL, category_groups); 688 OnStopTracingAcked(NULL, category_groups);
685 } 689 }
686 690
687 void TracingControllerImpl::OnTraceDataCollected( 691 void TracingControllerImpl::OnTraceDataCollected(
688 const scoped_refptr<base::RefCountedString>& events_str_ptr) { 692 const scoped_refptr<base::RefCountedString>& events_str_ptr) {
689 // OnTraceDataCollected may be called from any browser thread, either by the 693 // OnTraceDataCollected may be called from any browser thread, either by the
690 // local event trace system or from child processes via TraceMessageFilter. 694 // local event trace system or from child processes via TraceMessageFilter.
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 void TracingControllerImpl::RemoveTraceMessageFilterObserver( 913 void TracingControllerImpl::RemoveTraceMessageFilterObserver(
910 TraceMessageFilterObserver* observer) { 914 TraceMessageFilterObserver* observer) {
911 DCHECK_CURRENTLY_ON(BrowserThread::UI); 915 DCHECK_CURRENTLY_ON(BrowserThread::UI);
912 trace_message_filter_observers_.RemoveObserver(observer); 916 trace_message_filter_observers_.RemoveObserver(observer);
913 917
914 for (auto& filter : trace_message_filters_) 918 for (auto& filter : trace_message_filters_)
915 observer->OnTraceMessageFilterRemoved(filter.get()); 919 observer->OnTraceMessageFilterRemoved(filter.get());
916 } 920 }
917 921
918 } // namespace content 922 } // namespace content
OLDNEW
« content/browser/tracing/arc_tracing_agent.cc ('K') | « content/browser/tracing/arc_tracing_agent.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698