Implement SSLKEYLOGFILE for OpenSSL.
[chromium-blink-merge.git] / content / browser / devtools / devtools_tracing_handler.h
blobfe270bd847264bd4eb3283885a8cf0bce90af6ae
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/debug/trace_event.h"
12 #include "base/memory/weak_ptr.h"
13 #include "content/browser/devtools/devtools_protocol.h"
14 #include "content/public/browser/tracing_controller.h"
16 namespace base {
17 class RefCountedString;
18 class Timer;
21 namespace content {
23 // This class bridges DevTools remote debugging server with the trace
24 // infrastructure.
25 class DevToolsTracingHandler : public DevToolsProtocol::Handler {
26 public:
27 enum Target { Browser, Renderer };
28 explicit DevToolsTracingHandler(Target target);
29 virtual ~DevToolsTracingHandler();
31 void OnClientDetached();
33 void EnableTracing(const std::string& category_filter);
34 void DisableTracing();
36 private:
37 void BeginReadingRecordingResult(const base::FilePath& path);
38 void ReadRecordingResult(const scoped_refptr<base::RefCountedString>& result);
39 void OnTraceDataCollected(const std::string& trace_fragment);
40 void OnRecordingEnabled(scoped_refptr<DevToolsProtocol::Command> command);
41 void OnBufferUsage(float usage);
43 scoped_refptr<DevToolsProtocol::Response> OnStart(
44 scoped_refptr<DevToolsProtocol::Command> command);
45 scoped_refptr<DevToolsProtocol::Response> OnEnd(
46 scoped_refptr<DevToolsProtocol::Command> command);
48 scoped_refptr<DevToolsProtocol::Response> OnGetCategories(
49 scoped_refptr<DevToolsProtocol::Command> command);
51 void OnCategoriesReceived(scoped_refptr<DevToolsProtocol::Command> command,
52 const std::set<std::string>& category_set);
54 base::debug::TraceOptions TraceOptionsFromString(const std::string& options);
56 void SetupTimer(double usage_reporting_interval);
58 void DisableRecording(
59 const TracingController::TracingFileResultCallback& callback =
60 TracingController::TracingFileResultCallback());
62 base::WeakPtrFactory<DevToolsTracingHandler> weak_factory_;
63 scoped_ptr<base::Timer> buffer_usage_poll_timer_;
64 Target target_;
65 bool is_recording_;
67 static const char* kDefaultCategories;
68 static const double kDefaultReportingInterval;
69 static const double kMinimumReportingInterval;
71 DISALLOW_COPY_AND_ASSIGN(DevToolsTracingHandler);
74 } // namespace content
76 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_