| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 base::Bind(&DevToolsTracingHandler::OnBufferUsage, | 164 base::Bind(&DevToolsTracingHandler::OnBufferUsage, |
| 165 weak_factory_.GetWeakPtr())), | 165 weak_factory_.GetWeakPtr())), |
| 166 true)); | 166 true)); |
| 167 buffer_usage_poll_timer_->Reset(); | 167 buffer_usage_poll_timer_->Reset(); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 TracingController::GetInstance()->EnableRecording( | 171 TracingController::GetInstance()->EnableRecording( |
| 172 categories, options, TracingController::EnableRecordingDoneCallback()); | 172 categories, options, TracingController::EnableRecordingDoneCallback()); |
| 173 | 173 |
| 174 return NULL; | 174 return command->SuccessResponse(NULL); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void DevToolsTracingHandler::OnBufferUsage(float usage) { | 177 void DevToolsTracingHandler::OnBufferUsage(float usage) { |
| 178 base::DictionaryValue* params = new base::DictionaryValue(); | 178 base::DictionaryValue* params = new base::DictionaryValue(); |
| 179 params->SetDouble(devtools::Tracing::bufferUsage::kParamValue, usage); | 179 params->SetDouble(devtools::Tracing::bufferUsage::kParamValue, usage); |
| 180 SendNotification(devtools::Tracing::bufferUsage::kName, params); | 180 SendNotification(devtools::Tracing::bufferUsage::kName, params); |
| 181 } | 181 } |
| 182 | 182 |
| 183 scoped_refptr<DevToolsProtocol::Response> | 183 scoped_refptr<DevToolsProtocol::Response> |
| 184 DevToolsTracingHandler::OnEnd( | 184 DevToolsTracingHandler::OnEnd( |
| 185 scoped_refptr<DevToolsProtocol::Command> command) { | 185 scoped_refptr<DevToolsProtocol::Command> command) { |
| 186 buffer_usage_poll_timer_.reset(); | 186 buffer_usage_poll_timer_.reset(); |
| 187 TracingController::GetInstance()->DisableRecording( | 187 TracingController::GetInstance()->DisableRecording( |
| 188 base::FilePath(), | 188 base::FilePath(), |
| 189 base::Bind(&DevToolsTracingHandler::BeginReadingRecordingResult, | 189 base::Bind(&DevToolsTracingHandler::BeginReadingRecordingResult, |
| 190 weak_factory_.GetWeakPtr())); | 190 weak_factory_.GetWeakPtr())); |
| 191 return command->SuccessResponse(NULL); | 191 return command->SuccessResponse(NULL); |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace content | 194 } // namespace content |
| OLD | NEW |