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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 trace_data_sink_ = NULL; | 694 trace_data_sink_ = NULL; |
695 } | 695 } |
696 } | 696 } |
697 | 697 |
698 void TracingControllerImpl::OnEndAgentTracingAcked( | 698 void TracingControllerImpl::OnEndAgentTracingAcked( |
699 const std::string& agent_name, | 699 const std::string& agent_name, |
700 const std::string& events_label, | 700 const std::string& events_label, |
701 const scoped_refptr<base::RefCountedString>& events_str_ptr) { | 701 const scoped_refptr<base::RefCountedString>& events_str_ptr) { |
702 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 702 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
703 | 703 |
704 if (trace_data_sink_.get()) { | 704 if (trace_data_sink_.get() && events_str_ptr && !events_str_ptr->empty()) { |
705 std::string json_string; | 705 std::string json_string; |
706 if (agent_name == kETWTracingAgentName) { | 706 if (agent_name == kETWTracingAgentName) { |
707 // The Windows kernel events are kept into a JSON format stored as string | 707 // The Windows kernel events are kept into a JSON format stored as string |
708 // and must not be escaped. | 708 // and must not be escaped. |
709 json_string = events_str_ptr->data(); | 709 json_string = events_str_ptr->data(); |
710 } else { | 710 } else { |
711 json_string = base::GetQuotedJSONString(events_str_ptr->data()); | 711 json_string = base::GetQuotedJSONString(events_str_ptr->data()); |
712 } | 712 } |
713 trace_data_sink_->AddAgentTrace(events_label, json_string); | 713 trace_data_sink_->AddAgentTrace(events_label, json_string); |
714 } | 714 } |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 is_monitoring_ = is_monitoring; | 1123 is_monitoring_ = is_monitoring; |
1124 #if !defined(OS_ANDROID) | 1124 #if !defined(OS_ANDROID) |
1125 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); | 1125 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); |
1126 it != tracing_uis_.end(); it++) { | 1126 it != tracing_uis_.end(); it++) { |
1127 (*it)->OnMonitoringStateChanged(is_monitoring); | 1127 (*it)->OnMonitoringStateChanged(is_monitoring); |
1128 } | 1128 } |
1129 #endif | 1129 #endif |
1130 } | 1130 } |
1131 | 1131 |
1132 } // namespace content | 1132 } // namespace content |
OLD | NEW |