Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 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 virtual void AddTraceChunk(const std::string& chunk) {} | 40 virtual void AddTraceChunk(const std::string& chunk) {} |
| 41 virtual void SetSystemTrace(const std::string& data) {} | 41 |
| 42 virtual void AddAdditionalTracingAgentTrace(const std::string& agent_name, | |
|
shatch
2015/11/27 19:29:18
nit: Long name, maybe just AddAgentTrace?
Zhen Wang
2015/12/01 00:14:32
Done.
| |
| 43 const std::string& trace_data); | |
| 44 virtual const base::DictionaryValue& GetAdditionalTracingAgentTrace() const; | |
| 42 | 45 |
| 43 // Notice that TracingController adds some default metadata when | 46 // Notice that TracingController adds some default metadata when |
| 44 // DisableRecording is called, which may override metadata that you would | 47 // DisableRecording is called, which may override metadata that you would |
| 45 // set beforehand in case of key collision. | 48 // set beforehand in case of key collision. |
| 46 virtual void AddMetadata(const base::DictionaryValue& data); | 49 virtual void AddMetadata(const base::DictionaryValue& data); |
| 47 virtual const base::DictionaryValue& GetMetadata() const; | 50 virtual const base::DictionaryValue& GetMetadata() const; |
| 48 // TODO(prabhur) Replace all the Set* functions with a generic function: | 51 |
| 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() {} | 52 virtual void Close() {} |
| 53 | 53 |
| 54 protected: | 54 protected: |
| 55 friend class base::RefCountedThreadSafe<TraceDataSink>; | 55 friend class base::RefCountedThreadSafe<TraceDataSink>; |
| 56 virtual ~TraceDataSink() {} | 56 virtual ~TraceDataSink() {} |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 base::DictionaryValue additional_tracing_agent_trace_; | |
|
shatch
2015/11/27 19:29:18
Why not just a std::map?
Zhen Wang
2015/12/01 00:14:32
Done.
| |
| 59 base::DictionaryValue metadata_; | 60 base::DictionaryValue metadata_; |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 // An implementation of this interface is passed when constructing a | 63 // An implementation of this interface is passed when constructing a |
| 63 // TraceDataSink, and receives chunks of the final trace data as it's being | 64 // TraceDataSink, and receives chunks of the final trace data as it's being |
| 64 // constructed. | 65 // constructed. |
| 65 // Methods may be called from any thread. | 66 // Methods may be called from any thread. |
| 66 class CONTENT_EXPORT TraceDataEndpoint | 67 class CONTENT_EXPORT TraceDataEndpoint |
| 67 : public base::RefCountedThreadSafe<TraceDataEndpoint> { | 68 : public base::RefCountedThreadSafe<TraceDataEndpoint> { |
| 68 public: | 69 public: |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 // Check if the tracing system is tracing | 226 // Check if the tracing system is tracing |
| 226 virtual bool IsTracing() const = 0; | 227 virtual bool IsTracing() const = 0; |
| 227 | 228 |
| 228 protected: | 229 protected: |
| 229 virtual ~TracingController() {} | 230 virtual ~TracingController() {} |
| 230 }; | 231 }; |
| 231 | 232 |
| 232 } // namespace content | 233 } // namespace content |
| 233 | 234 |
| 234 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ | 235 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ |
| OLD | NEW |