Add a FrameHostMsg_BeginNavigation IPC
[chromium-blink-merge.git] / content / browser / devtools / devtools_tracing_handler.h
blob7c3b8e645e4bb6e8e6d52f8e7e412d6003fbc534
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 <set>
9 #include <string>
11 #include "base/memory/weak_ptr.h"
12 #include "content/browser/devtools/devtools_protocol.h"
13 #include "content/public/browser/tracing_controller.h"
15 namespace base {
16 class RefCountedString;
17 class Timer;
20 namespace content {
22 // This class bridges DevTools remote debugging server with the trace
23 // infrastructure.
24 class DevToolsTracingHandler : public DevToolsProtocol::Handler {
25 public:
26 enum Target { Browser, Renderer };
27 explicit DevToolsTracingHandler(Target target);
28 virtual ~DevToolsTracingHandler();
30 void OnClientDetached();
32 private:
33 void BeginReadingRecordingResult(const base::FilePath& path);
34 void ReadRecordingResult(const scoped_refptr<base::RefCountedString>& result);
35 void OnTraceDataCollected(const std::string& trace_fragment);
36 void OnTracingStarted(scoped_refptr<DevToolsProtocol::Command> command);
37 void OnBufferUsage(float usage);
39 scoped_refptr<DevToolsProtocol::Response> OnStart(
40 scoped_refptr<DevToolsProtocol::Command> command);
41 scoped_refptr<DevToolsProtocol::Response> OnEnd(
42 scoped_refptr<DevToolsProtocol::Command> command);
44 scoped_refptr<DevToolsProtocol::Response> OnGetCategories(
45 scoped_refptr<DevToolsProtocol::Command> command);
46 void OnCategoriesReceived(scoped_refptr<DevToolsProtocol::Command> command,
47 const std::set<std::string>& category_set);
49 TracingController::Options TraceOptionsFromString(const std::string& options);
51 void DisableRecording(
52 const TracingController::TracingFileResultCallback& callback =
53 TracingController::TracingFileResultCallback());
55 base::WeakPtrFactory<DevToolsTracingHandler> weak_factory_;
56 scoped_ptr<base::Timer> buffer_usage_poll_timer_;
57 Target target_;
58 DISALLOW_COPY_AND_ASSIGN(DevToolsTracingHandler);
61 } // namespace content
63 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_