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 19 matching lines...) Expand all Loading... | |
30 // An interface for trace data consumer. An implemnentation of this interface | 30 // An interface for trace data consumer. An implemnentation of this interface |
31 // is passed to either DisableTracing() or CaptureMonitoringSnapshot() and | 31 // is passed to either DisableTracing() or CaptureMonitoringSnapshot() and |
32 // receives the trace data followed by a notification that all child processes | 32 // receives the trace data followed by a notification that all child processes |
33 // have completed tracing and the data collection is over. | 33 // have completed tracing and the data collection is over. |
34 // All methods are called on the UI thread. | 34 // All methods are called on the UI thread. |
35 // Close method will be called exactly once and no methods will be | 35 // Close method will be called exactly once and no methods will be |
36 // called after that. | 36 // called after that. |
37 class CONTENT_EXPORT TraceDataSink | 37 class CONTENT_EXPORT TraceDataSink |
38 : public base::RefCountedThreadSafe<TraceDataSink> { | 38 : public base::RefCountedThreadSafe<TraceDataSink> { |
39 public: | 39 public: |
40 TraceDataSink(); | |
41 | |
40 virtual void AddTraceChunk(const std::string& chunk) {} | 42 virtual void AddTraceChunk(const std::string& chunk) {} |
41 virtual void SetSystemTrace(const std::string& data) {} | 43 |
44 virtual void AddAgentTrace(const std::string& trace_label, | |
45 const std::string& trace_data); | |
46 virtual const std::map<std::string, std::string>& | |
47 GetAdditionalTracingAgentTrace() const; | |
no sievers
2015/12/10 19:35:20
can you document what the two strings in the retur
Zhen Wang
2015/12/10 21:09:27
Done. This function should corresponds to AddAgent
| |
42 | 48 |
43 // Notice that TracingController adds some default metadata when | 49 // Notice that TracingController adds some default metadata when |
44 // DisableRecording is called, which may override metadata that you would | 50 // DisableRecording is called, which may override metadata that you would |
45 // set beforehand in case of key collision. | 51 // set beforehand in case of key collision. |
46 virtual void AddMetadata(const base::DictionaryValue& data); | 52 virtual void AddMetadata(const base::DictionaryValue& data); |
47 virtual const base::DictionaryValue& GetMetadata() const; | 53 virtual const base::DictionaryValue& GetMetadata() const; |
48 // TODO(prabhur) Replace all the Set* functions with a generic function: | 54 |
49 // TraceDataSink::AppendAdditionalData(const std::string& name, | |
50 // const std::string& trace_data) | |
51 virtual void SetPowerTrace(const std::string& data) {} | |
52 virtual void Close() {} | 55 virtual void Close() {} |
53 | 56 |
54 protected: | 57 protected: |
55 friend class base::RefCountedThreadSafe<TraceDataSink>; | 58 friend class base::RefCountedThreadSafe<TraceDataSink>; |
56 virtual ~TraceDataSink() {} | 59 virtual ~TraceDataSink(); |
57 | 60 |
58 private: | 61 private: |
62 std::map<std::string, std::string> additional_tracing_agent_trace_; | |
59 base::DictionaryValue metadata_; | 63 base::DictionaryValue metadata_; |
60 }; | 64 }; |
61 | 65 |
62 // An implementation of this interface is passed when constructing a | 66 // An implementation of this interface is passed when constructing a |
63 // TraceDataSink, and receives chunks of the final trace data as it's being | 67 // TraceDataSink, and receives chunks of the final trace data as it's being |
64 // constructed. | 68 // constructed. |
65 // Methods may be called from any thread. | 69 // Methods may be called from any thread. |
66 class CONTENT_EXPORT TraceDataEndpoint | 70 class CONTENT_EXPORT TraceDataEndpoint |
67 : public base::RefCountedThreadSafe<TraceDataEndpoint> { | 71 : public base::RefCountedThreadSafe<TraceDataEndpoint> { |
68 public: | 72 public: |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 // Check if the tracing system is tracing | 229 // Check if the tracing system is tracing |
226 virtual bool IsTracing() const = 0; | 230 virtual bool IsTracing() const = 0; |
227 | 231 |
228 protected: | 232 protected: |
229 virtual ~TracingController() {} | 233 virtual ~TracingController() {} |
230 }; | 234 }; |
231 | 235 |
232 } // namespace content | 236 } // namespace content |
233 | 237 |
234 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ | 238 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ |
OLD | NEW |