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 "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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 trace_data_sink_ = NULL; | 707 trace_data_sink_ = NULL; |
708 } | 708 } |
709 } | 709 } |
710 | 710 |
711 void TracingControllerImpl::OnEndAgentTracingAcked( | 711 void TracingControllerImpl::OnEndAgentTracingAcked( |
712 const std::string& agent_name, | 712 const std::string& agent_name, |
713 const std::string& events_label, | 713 const std::string& events_label, |
714 const scoped_refptr<base::RefCountedString>& events_str_ptr) { | 714 const scoped_refptr<base::RefCountedString>& events_str_ptr) { |
715 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 715 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
716 | 716 |
717 if (trace_data_sink_.get()) { | 717 if (trace_data_sink_.get() && events_str_ptr && |
| 718 !events_str_ptr->data().empty()) { |
718 std::string json_string; | 719 std::string json_string; |
719 if (agent_name == kETWTracingAgentName) { | 720 if (agent_name == kETWTracingAgentName) { |
720 // The Windows kernel events are kept into a JSON format stored as string | 721 // The Windows kernel events are kept into a JSON format stored as string |
721 // and must not be escaped. | 722 // and must not be escaped. |
722 json_string = events_str_ptr->data(); | 723 json_string = events_str_ptr->data(); |
723 } else { | 724 } else { |
724 json_string = base::GetQuotedJSONString(events_str_ptr->data()); | 725 json_string = base::GetQuotedJSONString(events_str_ptr->data()); |
725 } | 726 } |
726 trace_data_sink_->AddAgentTrace(events_label, json_string); | 727 trace_data_sink_->AddAgentTrace(events_label, json_string); |
727 } | 728 } |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 is_monitoring_ = is_monitoring; | 1137 is_monitoring_ = is_monitoring; |
1137 #if !defined(OS_ANDROID) | 1138 #if !defined(OS_ANDROID) |
1138 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); | 1139 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); |
1139 it != tracing_uis_.end(); it++) { | 1140 it != tracing_uis_.end(); it++) { |
1140 (*it)->OnMonitoringStateChanged(is_monitoring); | 1141 (*it)->OnMonitoringStateChanged(is_monitoring); |
1141 } | 1142 } |
1142 #endif | 1143 #endif |
1143 } | 1144 } |
1144 | 1145 |
1145 } // namespace content | 1146 } // namespace content |
OLD | NEW |