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

Side by Side Diff: content/browser/devtools/protocol/tracing_handler.cc

Issue 2180423004: DevTools: update transfer mode in Tracing.start when using start-up tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DevTools: update transfer mode in Tracing.start when using start-up tracing Created 4 years, 4 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
« no previous file with comments | « no previous file | 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 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 TracingCompleteParams::Create()->set_stream(stream_handle)); 172 TracingCompleteParams::Create()->set_stream(stream_handle));
173 } 173 }
174 174
175 Response TracingHandler::Start( 175 Response TracingHandler::Start(
176 DevToolsCommandId command_id, 176 DevToolsCommandId command_id,
177 const std::string* categories, 177 const std::string* categories,
178 const std::string* options, 178 const std::string* options,
179 const double* buffer_usage_reporting_interval, 179 const double* buffer_usage_reporting_interval,
180 const std::string* transfer_mode, 180 const std::string* transfer_mode,
181 const std::unique_ptr<base::DictionaryValue>& config) { 181 const std::unique_ptr<base::DictionaryValue>& config) {
182 if (IsTracing()) 182 if (IsTracing()) {
183 if (!did_initiate_recording_ && IsStartupTracingActive()) {
184 // If tracing is already running because it was initiated by startup
185 // tracing, honor the transfer mode update, as that's the only way
186 // for the client to communicate it.
187 return_as_stream_ =
188 transfer_mode && *transfer_mode == start::kTransferModeReturnAsStream;
189 }
183 return Response::InternalError("Tracing is already started"); 190 return Response::InternalError("Tracing is already started");
191 }
184 192
185 if (config && (categories || options)) { 193 if (config && (categories || options)) {
186 return Response::InternalError( 194 return Response::InternalError(
187 "Either trace config (preferred), or categories+options should be " 195 "Either trace config (preferred), or categories+options should be "
188 "specified, but not both."); 196 "specified, but not both.");
189 } 197 }
190 198
191 did_initiate_recording_ = true; 199 did_initiate_recording_ = true;
192 return_as_stream_ = 200 return_as_stream_ =
193 transfer_mode && *transfer_mode == start::kTransferModeReturnAsStream; 201 transfer_mode && *transfer_mode == start::kTransferModeReturnAsStream;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 std::string mode; 356 std::string mode;
349 if (tracing_dict->GetString(kRecordModeParam, &mode)) 357 if (tracing_dict->GetString(kRecordModeParam, &mode))
350 tracing_dict->SetString(kRecordModeParam, ConvertFromCamelCase(mode, '-')); 358 tracing_dict->SetString(kRecordModeParam, ConvertFromCamelCase(mode, '-'));
351 359
352 return base::trace_event::TraceConfig(*tracing_dict); 360 return base::trace_event::TraceConfig(*tracing_dict);
353 } 361 }
354 362
355 } // namespace tracing 363 } // namespace tracing
356 } // namespace devtools 364 } // namespace devtools
357 } // namespace content 365 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698