Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / devtools / devtools_tracing_handler.h
blob1d0c543b189f0307632265edaa965ddc25b2e491
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_
8 #include "base/memory/weak_ptr.h"
9 #include "content/browser/devtools/devtools_protocol.h"
10 #include "content/public/browser/tracing_controller.h"
12 namespace base {
13 class RefCountedString;
14 class Timer;
17 namespace content {
19 // This class bridges DevTools remote debugging server with the trace
20 // infrastructure.
21 class DevToolsTracingHandler : public DevToolsProtocol::Handler {
22 public:
23 DevToolsTracingHandler();
24 virtual ~DevToolsTracingHandler();
26 private:
27 void BeginReadingRecordingResult(const base::FilePath& path);
28 void ReadRecordingResult(const scoped_refptr<base::RefCountedString>& result);
29 void OnTraceDataCollected(const std::string& trace_fragment);
30 void OnBufferUsage(float usage);
32 scoped_refptr<DevToolsProtocol::Response> OnStart(
33 scoped_refptr<DevToolsProtocol::Command> command);
34 scoped_refptr<DevToolsProtocol::Response> OnEnd(
35 scoped_refptr<DevToolsProtocol::Command> command);
37 TracingController::Options TraceOptionsFromString(const std::string& options);
39 base::WeakPtrFactory<DevToolsTracingHandler> weak_factory_;
40 scoped_ptr<base::Timer> buffer_usage_poll_timer_;
41 DISALLOW_COPY_AND_ASSIGN(DevToolsTracingHandler);
44 } // namespace content
46 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_