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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 did_initiate_recording_ = true; | 188 did_initiate_recording_ = true; |
189 return_as_stream_ = return_as_stream; | 189 return_as_stream_ = return_as_stream; |
190 if (buffer_usage_reporting_interval.isJust()) | 190 if (buffer_usage_reporting_interval.isJust()) |
191 SetupTimer(buffer_usage_reporting_interval.fromJust()); | 191 SetupTimer(buffer_usage_reporting_interval.fromJust()); |
192 | 192 |
193 base::trace_event::TraceConfig trace_config; | 193 base::trace_event::TraceConfig trace_config; |
194 if (config.isJust()) { | 194 if (config.isJust()) { |
195 std::unique_ptr<base::Value> value = | 195 std::unique_ptr<base::Value> value = |
196 protocol::toBaseValue(config.fromJust()->toValue().get(), 1000); | 196 protocol::toBaseValue(config.fromJust()->toValue().get(), 1000); |
197 if (value && value->IsType(base::Value::TYPE_DICTIONARY)) { | 197 if (value && value->IsType(base::Value::Type::DICTIONARY)) { |
198 trace_config = GetTraceConfigFromDevToolsConfig( | 198 trace_config = GetTraceConfigFromDevToolsConfig( |
199 *static_cast<base::DictionaryValue*>(value.get())); | 199 *static_cast<base::DictionaryValue*>(value.get())); |
200 } | 200 } |
201 } else if (categories.isJust() || options.isJust()) { | 201 } else if (categories.isJust() || options.isJust()) { |
202 trace_config = base::trace_event::TraceConfig( | 202 trace_config = base::trace_event::TraceConfig( |
203 categories.fromMaybe(""), options.fromMaybe("")); | 203 categories.fromMaybe(""), options.fromMaybe("")); |
204 } | 204 } |
205 | 205 |
206 // If inspected target is a render process Tracing.start will be handled by | 206 // If inspected target is a render process Tracing.start will be handled by |
207 // tracing agent in the renderer. | 207 // tracing agent in the renderer. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 338 |
339 bool TracingHandler::IsStartupTracingActive() { | 339 bool TracingHandler::IsStartupTracingActive() { |
340 return ::tracing::TraceConfigFile::GetInstance()->IsEnabled() && | 340 return ::tracing::TraceConfigFile::GetInstance()->IsEnabled() && |
341 TracingController::GetInstance()->IsTracing(); | 341 TracingController::GetInstance()->IsTracing(); |
342 } | 342 } |
343 | 343 |
344 // static | 344 // static |
345 base::trace_event::TraceConfig TracingHandler::GetTraceConfigFromDevToolsConfig( | 345 base::trace_event::TraceConfig TracingHandler::GetTraceConfigFromDevToolsConfig( |
346 const base::DictionaryValue& devtools_config) { | 346 const base::DictionaryValue& devtools_config) { |
347 std::unique_ptr<base::Value> value = ConvertDictKeyStyle(devtools_config); | 347 std::unique_ptr<base::Value> value = ConvertDictKeyStyle(devtools_config); |
348 DCHECK(value && value->IsType(base::Value::TYPE_DICTIONARY)); | 348 DCHECK(value && value->IsType(base::Value::Type::DICTIONARY)); |
349 std::unique_ptr<base::DictionaryValue> tracing_dict( | 349 std::unique_ptr<base::DictionaryValue> tracing_dict( |
350 static_cast<base::DictionaryValue*>(value.release())); | 350 static_cast<base::DictionaryValue*>(value.release())); |
351 | 351 |
352 std::string mode; | 352 std::string mode; |
353 if (tracing_dict->GetString(kRecordModeParam, &mode)) | 353 if (tracing_dict->GetString(kRecordModeParam, &mode)) |
354 tracing_dict->SetString(kRecordModeParam, ConvertFromCamelCase(mode, '-')); | 354 tracing_dict->SetString(kRecordModeParam, ConvertFromCamelCase(mode, '-')); |
355 | 355 |
356 return base::trace_event::TraceConfig(*tracing_dict); | 356 return base::trace_event::TraceConfig(*tracing_dict); |
357 } | 357 } |
358 | 358 |
359 } // namespace tracing | 359 } // namespace tracing |
360 } // namespace protocol | 360 } // namespace protocol |
OLD | NEW |