Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(938)

Side by Side Diff: content/browser/devtools/devtools_tracing_handler.cc

Issue 256473004: DevTools: handle Tracing.start in both browser and renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/devtools/devtools_tracing_handler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 base::IgnoreResult(&TracingController::GetTraceBufferPercentFull), 162 base::IgnoreResult(&TracingController::GetTraceBufferPercentFull),
163 base::Unretained(TracingController::GetInstance()), 163 base::Unretained(TracingController::GetInstance()),
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, 172 categories, options, TracingController::EnableRecordingDoneCallback());
173 base::Bind(&DevToolsTracingHandler::OnTracingStarted,
174 weak_factory_.GetWeakPtr(),
175 command));
176 173
177 return command->AsyncResponsePromise(); 174 return NULL;
178 }
179
180 void DevToolsTracingHandler::OnTracingStarted(
181 scoped_refptr<DevToolsProtocol::Command> command) {
182 SendAsyncResponse(command->SuccessResponse(NULL));
183 } 175 }
184 176
185 void DevToolsTracingHandler::OnBufferUsage(float usage) { 177 void DevToolsTracingHandler::OnBufferUsage(float usage) {
186 base::DictionaryValue* params = new base::DictionaryValue(); 178 base::DictionaryValue* params = new base::DictionaryValue();
187 params->SetDouble(devtools::Tracing::bufferUsage::kParamValue, usage); 179 params->SetDouble(devtools::Tracing::bufferUsage::kParamValue, usage);
188 SendNotification(devtools::Tracing::bufferUsage::kName, params); 180 SendNotification(devtools::Tracing::bufferUsage::kName, params);
189 } 181 }
190 182
191 scoped_refptr<DevToolsProtocol::Response> 183 scoped_refptr<DevToolsProtocol::Response>
192 DevToolsTracingHandler::OnEnd( 184 DevToolsTracingHandler::OnEnd(
193 scoped_refptr<DevToolsProtocol::Command> command) { 185 scoped_refptr<DevToolsProtocol::Command> command) {
194 buffer_usage_poll_timer_.reset(); 186 buffer_usage_poll_timer_.reset();
195 TracingController::GetInstance()->DisableRecording( 187 TracingController::GetInstance()->DisableRecording(
196 base::FilePath(), 188 base::FilePath(),
197 base::Bind(&DevToolsTracingHandler::BeginReadingRecordingResult, 189 base::Bind(&DevToolsTracingHandler::BeginReadingRecordingResult,
198 weak_factory_.GetWeakPtr())); 190 weak_factory_.GetWeakPtr()));
199 return command->SuccessResponse(NULL); 191 return command->SuccessResponse(NULL);
200 } 192 }
201 193
202 } // namespace content 194 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools_tracing_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698