| Index: content/public/browser/tracing_controller.h
|
| diff --git a/content/public/browser/tracing_controller.h b/content/public/browser/tracing_controller.h
|
| index 67a28cd919f7b03291006b128946cf56a332d9b1..2232b5adece7d585ba2ef616fb201d1c3fb59d34 100644
|
| --- a/content/public/browser/tracing_controller.h
|
| +++ b/content/public/browser/tracing_controller.h
|
| @@ -12,10 +12,6 @@
|
| #include "base/debug/trace_event.h"
|
| #include "content/common/content_export.h"
|
|
|
| -namespace base {
|
| -class FilePath;
|
| -};
|
| -
|
| namespace content {
|
|
|
| class TracingController;
|
| @@ -29,6 +25,22 @@ class TracingController {
|
|
|
| CONTENT_EXPORT static TracingController* GetInstance();
|
|
|
| + // An interface for trace data consumer. An implemnentation of this interface
|
| + // is passed to either DisableTracing() or CaptureMonitoringSnapshot() and
|
| + // receives the trace data followed by a notification that all child processes
|
| + // have completed tracing and the data collection is over.
|
| + // All methods are called on the UI thread.
|
| + // Close method will be called exactly once and no methods will be
|
| + // called after that.
|
| + class CONTENT_EXPORT TraceDataSink {
|
| + public:
|
| + virtual ~TraceDataSink() {}
|
| +
|
| + virtual void AddTraceChunk(const std::string& chunk) {}
|
| + virtual void SetSystemTrace(const std::string& data) {}
|
| + virtual void Close() {}
|
| + };
|
| +
|
| // Get a set of category groups. The category groups can change as
|
| // new code paths are reached.
|
| //
|
| @@ -76,15 +88,11 @@ class TracingController {
|
| // TracingFileResultCallback will be called back with a file that contains
|
| // the traced data.
|
| //
|
| - // Trace data will be written into |result_file_path| if it is not empty, or
|
| - // into a temporary file. The actual file path will be passed to |callback| if
|
| - // it's not null.
|
| + // If |trace_data_sink| is not null, it will receive chunks of trace data
|
| + // as a comma-separated sequences of JSON-stringified events, followed by
|
| + // a notification that the trace collection is finished.
|
| //
|
| - // If |result_file_path| is empty and |callback| is null, trace data won't be
|
| - // written to any file.
|
| - typedef base::Callback<void(const base::FilePath&)> TracingFileResultCallback;
|
| - virtual bool DisableRecording(const base::FilePath& result_file_path,
|
| - const TracingFileResultCallback& callback) = 0;
|
| + virtual bool DisableRecording(TraceDataSink *trace_data_sink) = 0;
|
|
|
| // Start monitoring on all processes.
|
| //
|
| @@ -130,14 +138,10 @@ class TracingController {
|
| // request, TracingFileResultCallback will be called back with a file that
|
| // contains the traced data.
|
| //
|
| - // Trace data will be written into |result_file_path| if it is not empty, or
|
| - // into a temporary file. The actual file path will be passed to |callback|.
|
| - //
|
| - // If |result_file_path| is empty and |callback| is null, trace data won't be
|
| - // written to any file.
|
| - virtual bool CaptureMonitoringSnapshot(
|
| - const base::FilePath& result_file_path,
|
| - const TracingFileResultCallback& callback) = 0;
|
| + // If |trace_data_sink| is not null, it will receive chunks of trace data
|
| + // as a comma-separated sequences of JSON-stringified events, followed by
|
| + // a notification that the trace collection is finished.
|
| + virtual bool CaptureMonitoringSnapshot(TraceDataSink* trace_data_sink) = 0;
|
|
|
| // Get the maximum across processes of trace buffer percent full state.
|
| // When the TraceBufferPercentFull value is determined, the callback is
|
|
|