blob: 43cd6150edaa11e09827c7b362ad8f3a3034f2cd [file] [log] [blame]
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +00001// 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.
4
5#ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_
6#define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_
7
8#include "base/debug/trace_event.h"
9#include "content/browser/devtools/devtools_protocol.h"
10#include "content/public/browser/trace_subscriber.h"
11
12namespace content {
13
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000014// This class bridges DevTools remote debugging server with the trace
15// infrastructure.
16class DevToolsTracingHandler
17 : public TraceSubscriber,
18 public DevToolsProtocol::Handler {
19 public:
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000020 DevToolsTracingHandler();
21 virtual ~DevToolsTracingHandler();
22
23 // TraceSubscriber:
24 virtual void OnEndTracingComplete() OVERRIDE;;
25 virtual void OnTraceDataCollected(
26 const scoped_refptr<base::RefCountedString>& trace_fragment) OVERRIDE;
27
28 private:
Ben Murdochbb1529c2013-08-08 10:24:53 +010029 scoped_refptr<DevToolsProtocol::Response> OnStart(
30 scoped_refptr<DevToolsProtocol::Command> command);
31 scoped_refptr<DevToolsProtocol::Response> OnEnd(
32 scoped_refptr<DevToolsProtocol::Command> command);
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000033
34 base::debug::TraceLog::Options TraceOptionsFromString(
35 const std::string& options);
36
37 bool is_running_;
38
39 DISALLOW_COPY_AND_ASSIGN(DevToolsTracingHandler);
40};
41
42} // namespace content
43
44#endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_