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 23 matching lines...) Expand all Loading... |
34 // have completed tracing and the data collection is over. | 34 // have completed tracing and the data collection is over. |
35 // All methods are called on the UI thread. | 35 // All methods are called on the UI thread. |
36 // Close method will be called exactly once and no methods will be | 36 // Close method will be called exactly once and no methods will be |
37 // called after that. | 37 // called after that. |
38 class CONTENT_EXPORT TraceDataSink | 38 class CONTENT_EXPORT TraceDataSink |
39 : public base::RefCountedThreadSafe<TraceDataSink> { | 39 : public base::RefCountedThreadSafe<TraceDataSink> { |
40 public: | 40 public: |
41 TraceDataSink(); | 41 TraceDataSink(); |
42 | 42 |
43 virtual void AddTraceChunk(const std::string& chunk) {} | 43 virtual void AddTraceChunk(const std::string& chunk) {} |
44 virtual void SetSystemTrace(const std::string& data) {} | 44 |
| 45 // Add a TracingAgent's trace to the data sink. |
| 46 virtual void AddAgentTrace(const std::string& trace_label, |
| 47 const std::string& trace_data); |
45 | 48 |
46 // Notice that TracingController adds some default metadata when | 49 // Notice that TracingController adds some default metadata when |
47 // StopTracing is called, which may override metadata that you would | 50 // StopTracing is called, which may override metadata that you would |
48 // set beforehand in case of key collision. | 51 // set beforehand in case of key collision. |
49 virtual void AddMetadata(const base::DictionaryValue& data); | 52 virtual void AddMetadata(const base::DictionaryValue& data); |
50 virtual scoped_ptr<const base::DictionaryValue> GetMetadataCopy() const; | 53 virtual scoped_ptr<const base::DictionaryValue> GetMetadataCopy() const; |
51 virtual void SetMetadataFilterPredicate( | 54 virtual void SetMetadataFilterPredicate( |
52 const MetadataFilterPredicate& metadata_filter_predicate); | 55 const MetadataFilterPredicate& metadata_filter_predicate); |
53 // TODO(prabhur) Replace all the Set* functions with a generic function: | |
54 // TraceDataSink::AppendAdditionalData(const std::string& name, | |
55 // const std::string& trace_data) | |
56 virtual void SetPowerTrace(const std::string& data) {} | |
57 virtual void Close() {} | 56 virtual void Close() {} |
58 | 57 |
59 protected: | 58 protected: |
60 friend class base::RefCountedThreadSafe<TraceDataSink>; | 59 friend class base::RefCountedThreadSafe<TraceDataSink>; |
| 60 |
| 61 // Get a map of TracingAgent's data, which is previously added by |
| 62 // AddAgentTrace(). The map's key is the trace label and the map's value is |
| 63 // the trace data. |
| 64 virtual const std::map<std::string, std::string>& GetAgentTrace() const; |
| 65 |
61 virtual ~TraceDataSink(); | 66 virtual ~TraceDataSink(); |
62 | 67 |
63 private: | 68 private: |
| 69 std::map<std::string, std::string> additional_tracing_agent_trace_; |
64 MetadataFilterPredicate metadata_filter_predicate_; | 70 MetadataFilterPredicate metadata_filter_predicate_; |
65 base::DictionaryValue metadata_; | 71 base::DictionaryValue metadata_; |
66 }; | 72 }; |
67 | 73 |
68 // An implementation of this interface is passed when constructing a | 74 // An implementation of this interface is passed when constructing a |
69 // TraceDataSink, and receives chunks of the final trace data as it's being | 75 // TraceDataSink, and receives chunks of the final trace data as it's being |
70 // constructed. | 76 // constructed. |
71 // Methods may be called from any thread. | 77 // Methods may be called from any thread. |
72 class CONTENT_EXPORT TraceDataEndpoint | 78 class CONTENT_EXPORT TraceDataEndpoint |
73 : public base::RefCountedThreadSafe<TraceDataEndpoint> { | 79 : public base::RefCountedThreadSafe<TraceDataEndpoint> { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // Check if the tracing system is tracing | 237 // Check if the tracing system is tracing |
232 virtual bool IsTracing() const = 0; | 238 virtual bool IsTracing() const = 0; |
233 | 239 |
234 protected: | 240 protected: |
235 virtual ~TracingController() {} | 241 virtual ~TracingController() {} |
236 }; | 242 }; |
237 | 243 |
238 } // namespace content | 244 } // namespace content |
239 | 245 |
240 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ | 246 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ |
OLD | NEW |