| 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 d5cd8597cdd2fd7a4a31a950df3ba4a2d43ba8a2..30f13d160027b65478b0083b35b8789765c30e65 100644
|
| --- a/content/browser/devtools/devtools_tracing_handler.cc
|
| +++ b/content/browser/devtools/devtools_tracing_handler.cc
|
| @@ -113,11 +113,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");
|
| + }
|
| is_recording_ = true;
|
|
|
| std::string categories;
|
| @@ -139,6 +137,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,
|
| @@ -182,11 +190,14 @@ 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");
|
| + }
|
| + DisableRecording(false);
|
| // If inspected target is a render process Tracing.end will be handled by
|
| // tracing agent in the renderer.
|
| if (target_ == Renderer)
|
| return NULL;
|
| - DisableRecording(false);
|
| return command->SuccessResponse(NULL);
|
| }
|
|
|
| @@ -227,26 +238,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(false);
|
| -}
|
| -
|
| -
|
| } // namespace content
|
|
|