OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "content/browser/devtools/devtools_protocol.h" | 9 #include "content/browser/devtools/devtools_protocol.h" |
10 #include "content/public/browser/tracing_controller.h" | 10 #include "content/public/browser/tracing_controller.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class RefCountedString; | 13 class RefCountedString; |
14 class Timer; | 14 class Timer; |
15 } | 15 } |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 // This class bridges DevTools remote debugging server with the trace | 19 // This class bridges DevTools remote debugging server with the trace |
20 // infrastructure. | 20 // infrastructure. |
21 class DevToolsTracingHandler : public DevToolsProtocol::Handler { | 21 class DevToolsTracingHandler : public DevToolsProtocol::Handler { |
22 public: | 22 public: |
23 enum Target { Browser, Renderer }; | 23 enum Target { Browser, Renderer }; |
24 explicit DevToolsTracingHandler(Target target); | 24 explicit DevToolsTracingHandler(Target target); |
25 virtual ~DevToolsTracingHandler(); | 25 virtual ~DevToolsTracingHandler(); |
26 | 26 |
| 27 void OnClientDetached(); |
| 28 |
27 private: | 29 private: |
28 void BeginReadingRecordingResult(const base::FilePath& path); | 30 void BeginReadingRecordingResult(const base::FilePath& path); |
29 void ReadRecordingResult(const scoped_refptr<base::RefCountedString>& result); | 31 void ReadRecordingResult(const scoped_refptr<base::RefCountedString>& result); |
30 void OnTraceDataCollected(const std::string& trace_fragment); | 32 void OnTraceDataCollected(const std::string& trace_fragment); |
31 void OnTracingStarted(scoped_refptr<DevToolsProtocol::Command> command); | 33 void OnTracingStarted(scoped_refptr<DevToolsProtocol::Command> command); |
32 void OnBufferUsage(float usage); | 34 void OnBufferUsage(float usage); |
33 | 35 |
34 scoped_refptr<DevToolsProtocol::Response> OnStart( | 36 scoped_refptr<DevToolsProtocol::Response> OnStart( |
35 scoped_refptr<DevToolsProtocol::Command> command); | 37 scoped_refptr<DevToolsProtocol::Command> command); |
36 scoped_refptr<DevToolsProtocol::Response> OnEnd( | 38 scoped_refptr<DevToolsProtocol::Response> OnEnd( |
37 scoped_refptr<DevToolsProtocol::Command> command); | 39 scoped_refptr<DevToolsProtocol::Command> command); |
38 | 40 |
39 TracingController::Options TraceOptionsFromString(const std::string& options); | 41 TracingController::Options TraceOptionsFromString(const std::string& options); |
40 | 42 |
| 43 void DisableRecording( |
| 44 const TracingController::TracingFileResultCallback& callback = |
| 45 TracingController::TracingFileResultCallback()); |
| 46 |
41 base::WeakPtrFactory<DevToolsTracingHandler> weak_factory_; | 47 base::WeakPtrFactory<DevToolsTracingHandler> weak_factory_; |
42 scoped_ptr<base::Timer> buffer_usage_poll_timer_; | 48 scoped_ptr<base::Timer> buffer_usage_poll_timer_; |
43 Target target_; | 49 Target target_; |
44 DISALLOW_COPY_AND_ASSIGN(DevToolsTracingHandler); | 50 DISALLOW_COPY_AND_ASSIGN(DevToolsTracingHandler); |
45 }; | 51 }; |
46 | 52 |
47 } // namespace content | 53 } // namespace content |
48 | 54 |
49 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_ | 55 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_ |
OLD | NEW |