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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 void TracingControllerImpl::ResultFile::CloseTask( | 127 void TracingControllerImpl::ResultFile::CloseTask( |
128 const base::Closure& callback) { | 128 const base::Closure& callback) { |
129 if (!file_) | 129 if (!file_) |
130 return; | 130 return; |
131 | 131 |
132 const char* trailevents = "]"; | 132 const char* trailevents = "]"; |
133 size_t written = fwrite(trailevents, strlen(trailevents), 1, file_); | 133 size_t written = fwrite(trailevents, strlen(trailevents), 1, file_); |
134 DCHECK(written == 1); | 134 DCHECK(written == 1); |
135 | 135 |
136 if (system_trace_) { | 136 if (system_trace_.get()) { |
137 #if defined(OS_WIN) | 137 #if defined(OS_WIN) |
138 // The Windows kernel events are kept into a JSon format stored as string | 138 // The Windows kernel events are kept into a JSon format stored as string |
139 // and must not be escaped. | 139 // and must not be escaped. |
140 std::string json_string = system_trace_->data(); | 140 std::string json_string = system_trace_->data(); |
141 #else | 141 #else |
142 std::string json_string = base::GetQuotedJSONString(system_trace_->data()); | 142 std::string json_string = base::GetQuotedJSONString(system_trace_->data()); |
143 #endif | 143 #endif |
144 | 144 |
145 const char* systemTraceHead = ",\n\"systemTraceEvents\": "; | 145 const char* systemTraceHead = ",\n\"systemTraceEvents\": "; |
146 written = fwrite(systemTraceHead, strlen(systemTraceHead), 1, file_); | 146 written = fwrite(systemTraceHead, strlen(systemTraceHead), 1, file_); |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 is_monitoring_ = is_monitoring; | 902 is_monitoring_ = is_monitoring; |
903 #if !defined(OS_ANDROID) | 903 #if !defined(OS_ANDROID) |
904 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); | 904 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); |
905 it != tracing_uis_.end(); it++) { | 905 it != tracing_uis_.end(); it++) { |
906 (*it)->OnMonitoringStateChanged(is_monitoring); | 906 (*it)->OnMonitoringStateChanged(is_monitoring); |
907 } | 907 } |
908 #endif | 908 #endif |
909 } | 909 } |
910 | 910 |
911 } // namespace content | 911 } // namespace content |
OLD | NEW |