Chromium Code Reviews| Index: content/browser/devtools/devtools_tracing_handler.cc |
| diff --git a/content/browser/devtools/devtools_tracing_handler.cc b/content/browser/devtools/devtools_tracing_handler.cc |
| index da4b82301612210e1d70da69f9cab29461f2cd54..d0f62e9816e81c72d91d65066f57ea6164c731e7 100644 |
| --- a/content/browser/devtools/devtools_tracing_handler.cc |
| +++ b/content/browser/devtools/devtools_tracing_handler.cc |
| @@ -148,11 +148,9 @@ base::debug::TraceOptions DevToolsTracingHandler::TraceOptionsFromString( |
| scoped_refptr<DevToolsProtocol::Response> |
| DevToolsTracingHandler::OnStart( |
| scoped_refptr<DevToolsProtocol::Command> command) { |
| - // If inspected target is a render process Tracing.start will be handled by |
| - // tracing agent in the renderer. |
| - if (target_ == Renderer) |
| - return NULL; |
| - |
| + if (is_recording_) { |
| + return command->InternalErrorResponse("Tracing is already started."); |
|
caseq
2014/09/15 11:38:17
nit: we don't use terminating punctuation in proto
yurys
2014/09/15 12:02:18
Done.
|
| + } |
| is_recording_ = true; |
| std::string categories; |
| @@ -174,6 +172,16 @@ DevToolsTracingHandler::OnStart( |
| SetupTimer(usage_reporting_interval); |
| + // If inspected target is a render process Tracing.start will be handled by |
| + // tracing agent in the renderer. |
| + if (target_ == Renderer) { |
| + TracingController::GetInstance()->EnableRecording( |
| + base::debug::CategoryFilter(categories), |
| + options, |
| + TracingController::EnableRecordingDoneCallback()); |
| + return NULL; |
| + } |
| + |
| TracingController::GetInstance()->EnableRecording( |
| base::debug::CategoryFilter(categories), |
| options, |
| @@ -217,13 +225,16 @@ void DevToolsTracingHandler::OnBufferUsage(float usage) { |
| scoped_refptr<DevToolsProtocol::Response> |
| DevToolsTracingHandler::OnEnd( |
| scoped_refptr<DevToolsProtocol::Command> command) { |
| + if (!is_recording_) { |
| + return command->InternalErrorResponse("Tracing is not started."); |
|
caseq
2014/09/15 11:38:17
ditto.
yurys
2014/09/15 12:02:18
Done.
|
| + } |
| + DisableRecording( |
| + base::Bind(&DevToolsTracingHandler::BeginReadingRecordingResult, |
|
caseq
2014/09/15 11:38:17
You'll need to rebaseline this against r294801.
yurys
2014/09/15 12:02:17
Done.
|
| + weak_factory_.GetWeakPtr())); |
| // If inspected target is a render process Tracing.end will be handled by |
| // tracing agent in the renderer. |
| if (target_ == Renderer) |
| return NULL; |
| - DisableRecording( |
| - base::Bind(&DevToolsTracingHandler::BeginReadingRecordingResult, |
| - weak_factory_.GetWeakPtr())); |
| return command->SuccessResponse(NULL); |
| } |
| @@ -265,28 +276,4 @@ void DevToolsTracingHandler::OnCategoriesReceived( |
| SendAsyncResponse(command->SuccessResponse(response)); |
| } |
| -void DevToolsTracingHandler::EnableTracing(const std::string& category_filter) { |
| - if (is_recording_) |
| - return; |
| - is_recording_ = true; |
| - |
| - SetupTimer(kDefaultReportingInterval); |
| - |
| - TracingController::GetInstance()->EnableRecording( |
| - base::debug::CategoryFilter(category_filter), |
| - base::debug::TraceOptions(), |
| - TracingController::EnableRecordingDoneCallback()); |
| - SendNotification(devtools::Tracing::started::kName, NULL); |
| -} |
| - |
| -void DevToolsTracingHandler::DisableTracing() { |
| - if (!is_recording_) |
| - return; |
| - is_recording_ = false; |
| - DisableRecording( |
| - base::Bind(&DevToolsTracingHandler::BeginReadingRecordingResult, |
| - weak_factory_.GetWeakPtr())); |
| -} |
| - |
| - |
| } // namespace content |