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/debug/trace_event.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/trace_subscriber.h" | 10 |
| 11 namespace base { |
| 12 class FilePath; |
| 13 } |
11 | 14 |
12 namespace content { | 15 namespace content { |
13 | 16 |
14 // This class bridges DevTools remote debugging server with the trace | 17 // This class bridges DevTools remote debugging server with the trace |
15 // infrastructure. | 18 // infrastructure. |
16 class DevToolsTracingHandler | 19 class DevToolsTracingHandler : public DevToolsProtocol::Handler { |
17 : public TraceSubscriber, | |
18 public DevToolsProtocol::Handler { | |
19 public: | 20 public: |
20 DevToolsTracingHandler(); | 21 DevToolsTracingHandler(); |
21 virtual ~DevToolsTracingHandler(); | 22 virtual ~DevToolsTracingHandler(); |
22 | 23 |
23 // TraceSubscriber: | 24 private: |
24 virtual void OnEndTracingComplete() OVERRIDE;; | 25 void BeginReadingRecordingResult(const base::FilePath& path); |
25 virtual void OnTraceDataCollected( | 26 void ReadRecordingResult(const base::FilePath& path); |
26 const scoped_refptr<base::RefCountedString>& trace_fragment) OVERRIDE; | 27 void OnTraceBufferPercentFullResult(float percent_full); |
27 | 28 |
28 private: | |
29 scoped_refptr<DevToolsProtocol::Response> OnStart( | 29 scoped_refptr<DevToolsProtocol::Response> OnStart( |
30 scoped_refptr<DevToolsProtocol::Command> command); | 30 scoped_refptr<DevToolsProtocol::Command> command); |
| 31 scoped_refptr<DevToolsProtocol::Response> OnGetTraceBufferPercentFull( |
| 32 scoped_refptr<DevToolsProtocol::Command> command); |
31 scoped_refptr<DevToolsProtocol::Response> OnEnd( | 33 scoped_refptr<DevToolsProtocol::Response> OnEnd( |
32 scoped_refptr<DevToolsProtocol::Command> command); | 34 scoped_refptr<DevToolsProtocol::Command> command); |
33 | 35 |
34 base::debug::TraceLog::Options TraceOptionsFromString( | |
35 const std::string& options); | |
36 | |
37 bool is_running_; | 36 bool is_running_; |
| 37 base::WeakPtrFactory<DevToolsTracingHandler> weak_factory_; |
38 | 38 |
39 DISALLOW_COPY_AND_ASSIGN(DevToolsTracingHandler); | 39 DISALLOW_COPY_AND_ASSIGN(DevToolsTracingHandler); |
40 }; | 40 }; |
41 | 41 |
42 } // namespace content | 42 } // namespace content |
43 | 43 |
44 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_ | 44 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_TRACING_HANDLER_H_ |
OLD | NEW |