OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 public: | 38 public: |
39 virtual void AddTraceChunk(const std::string& chunk) {} | 39 virtual void AddTraceChunk(const std::string& chunk) {} |
40 virtual void SetSystemTrace(const std::string& data) {} | 40 virtual void SetSystemTrace(const std::string& data) {} |
41 virtual void Close() {} | 41 virtual void Close() {} |
42 | 42 |
43 protected: | 43 protected: |
44 friend class base::RefCountedThreadSafe<TraceDataSink>; | 44 friend class base::RefCountedThreadSafe<TraceDataSink>; |
45 virtual ~TraceDataSink() {} | 45 virtual ~TraceDataSink() {} |
46 }; | 46 }; |
47 | 47 |
| 48 // An implementation of this interface is passed when constructing a |
| 49 // TraceDataSink, and receives chunks of the final trace data as it's being |
| 50 // constructed. |
| 51 // Methods may be called from any thread. |
| 52 class CONTENT_EXPORT TraceDataEndpoint |
| 53 : public base::RefCountedThreadSafe<TraceDataEndpoint> { |
| 54 public: |
| 55 virtual void ReceiveTraceChunk(const std::string& chunk) {} |
| 56 virtual void ReceiveTraceFinalContents(const std::string& contents) {} |
| 57 |
| 58 protected: |
| 59 friend class base::RefCountedThreadSafe<TraceDataEndpoint>; |
| 60 virtual ~TraceDataEndpoint() {} |
| 61 }; |
| 62 |
48 // Create a trace sink that may be supplied to DisableRecording or | 63 // Create a trace sink that may be supplied to DisableRecording or |
49 // CaptureMonitoringSnapshot to capture the trace data as a string. | 64 // CaptureMonitoringSnapshot to capture the trace data as a string. |
50 CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateStringSink( | 65 CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateStringSink( |
51 const base::Callback<void(base::RefCountedString*)>& callback); | 66 const base::Callback<void(base::RefCountedString*)>& callback); |
52 | 67 |
| 68 CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateCompressedStringSink( |
| 69 scoped_refptr<TraceDataEndpoint> endpoint); |
| 70 |
53 // Create a trace sink that may be supplied to DisableRecording or | 71 // Create a trace sink that may be supplied to DisableRecording or |
54 // CaptureMonitoringSnapshot to dump the trace data to a file. | 72 // CaptureMonitoringSnapshot to dump the trace data to a file. |
55 CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateFileSink( | 73 CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateFileSink( |
56 const base::FilePath& file_path, | 74 const base::FilePath& file_path, |
57 const base::Closure& callback); | 75 const base::Closure& callback); |
58 | 76 |
59 // Get a set of category groups. The category groups can change as | 77 // Get a set of category groups. The category groups can change as |
60 // new code paths are reached. | 78 // new code paths are reached. |
61 // | 79 // |
62 // Once all child processes have acked to the GetCategories request, | 80 // Once all child processes have acked to the GetCategories request, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // watch event callback. | 196 // watch event callback. |
179 virtual bool CancelWatchEvent() = 0; | 197 virtual bool CancelWatchEvent() = 0; |
180 | 198 |
181 protected: | 199 protected: |
182 virtual ~TracingController() {} | 200 virtual ~TracingController() {} |
183 }; | 201 }; |
184 | 202 |
185 } // namespace content | 203 } // namespace content |
186 | 204 |
187 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ | 205 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ |
OLD | NEW |