OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/devtools_tracing_handler.h" | 5 #include "content/browser/devtools/devtools_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/callback.h" | 10 #include "base/callback.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 void DevToolsTracingHandler::OnBufferUsage(float usage) { | 194 void DevToolsTracingHandler::OnBufferUsage(float usage) { |
195 base::DictionaryValue* params = new base::DictionaryValue(); | 195 base::DictionaryValue* params = new base::DictionaryValue(); |
196 params->SetDouble(devtools::Tracing::bufferUsage::kParamValue, usage); | 196 params->SetDouble(devtools::Tracing::bufferUsage::kParamValue, usage); |
197 SendNotification(devtools::Tracing::bufferUsage::kName, params); | 197 SendNotification(devtools::Tracing::bufferUsage::kName, params); |
198 } | 198 } |
199 | 199 |
200 scoped_refptr<DevToolsProtocol::Response> | 200 scoped_refptr<DevToolsProtocol::Response> |
201 DevToolsTracingHandler::OnEnd( | 201 DevToolsTracingHandler::OnEnd( |
202 scoped_refptr<DevToolsProtocol::Command> command) { | 202 scoped_refptr<DevToolsProtocol::Command> command) { |
203 buffer_usage_poll_timer_.reset(); | 203 DisableRecording( |
204 TracingController::GetInstance()->DisableRecording( | |
205 base::FilePath(), | |
206 base::Bind(&DevToolsTracingHandler::BeginReadingRecordingResult, | 204 base::Bind(&DevToolsTracingHandler::BeginReadingRecordingResult, |
207 weak_factory_.GetWeakPtr())); | 205 weak_factory_.GetWeakPtr())); |
208 return command->SuccessResponse(NULL); | 206 return command->SuccessResponse(NULL); |
209 } | 207 } |
210 | 208 |
| 209 void DevToolsTracingHandler::DisableRecording( |
| 210 const TracingController::TracingFileResultCallback& callback) { |
| 211 buffer_usage_poll_timer_.reset(); |
| 212 TracingController::GetInstance()->DisableRecording(base::FilePath(), |
| 213 callback); |
| 214 } |
| 215 |
| 216 void DevToolsTracingHandler::OnClientDetached() { |
| 217 DisableRecording(); |
| 218 } |
| 219 |
211 } // namespace content | 220 } // namespace content |
OLD | NEW |