| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 | 4 |
| 5 #include "content/browser/devtools/protocol/tracing_handler.h" | 5 #include "content/browser/devtools/protocol/tracing_handler.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 void TracingHandler::OnTraceDataCollected(const std::string& trace_fragment) { | 107 void TracingHandler::OnTraceDataCollected(const std::string& trace_fragment) { |
| 108 // Hand-craft protocol notification message so we can substitute JSON | 108 // Hand-craft protocol notification message so we can substitute JSON |
| 109 // that we already got as string as a bare object, not a quoted string. | 109 // that we already got as string as a bare object, not a quoted string. |
| 110 std::string message( | 110 std::string message( |
| 111 "{ \"method\": \"Tracing.dataCollected\", \"params\": { \"value\": ["); | 111 "{ \"method\": \"Tracing.dataCollected\", \"params\": { \"value\": ["); |
| 112 const size_t messageSuffixSize = 10; | 112 const size_t messageSuffixSize = 10; |
| 113 message.reserve(message.size() + trace_fragment.size() + messageSuffixSize); | 113 message.reserve(message.size() + trace_fragment.size() + messageSuffixSize); |
| 114 message += trace_fragment; | 114 message += trace_fragment; |
| 115 message += "] } }"; | 115 message += "] } }"; |
| 116 client_->SendRawNotification(message); | 116 client_->SendRawMessage(message); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void TracingHandler::OnTraceComplete() { | 119 void TracingHandler::OnTraceComplete() { |
| 120 client_->TracingComplete(TracingCompleteParams::Create()); | 120 client_->TracingComplete(TracingCompleteParams::Create()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void TracingHandler::OnTraceToStreamComplete(const std::string& stream_handle) { | 123 void TracingHandler::OnTraceToStreamComplete(const std::string& stream_handle) { |
| 124 client_->TracingComplete( | 124 client_->TracingComplete( |
| 125 TracingCompleteParams::Create()->set_stream(stream_handle)); | 125 TracingCompleteParams::Create()->set_stream(stream_handle)); |
| 126 } | 126 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } | 263 } |
| 264 | 264 |
| 265 bool TracingHandler::IsStartupTracingActive() { | 265 bool TracingHandler::IsStartupTracingActive() { |
| 266 return ::tracing::TraceConfigFile::GetInstance()->IsEnabled() && | 266 return ::tracing::TraceConfigFile::GetInstance()->IsEnabled() && |
| 267 TracingController::GetInstance()->IsRecording(); | 267 TracingController::GetInstance()->IsRecording(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace tracing | 270 } // namespace tracing |
| 271 } // namespace devtools | 271 } // namespace devtools |
| 272 } // namespace content | 272 } // namespace content |
| OLD | NEW |