Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(957)

Unified Diff: content/browser/tracing/tracing_controller_impl.h

Issue 2052773002: Clean up public TracingController interface [1/3]: hide TraceDataEndpoint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased, added CONTENT_EXPORT where missing Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/tracing/tracing_controller_impl.h
diff --git a/content/browser/tracing/tracing_controller_impl.h b/content/browser/tracing/tracing_controller_impl.h
index a391cdbde3436e610009c3f285954d8f379fa745..410ee4a4eacec181418e0700608d3af7cc519400 100644
--- a/content/browser/tracing/tracing_controller_impl.h
+++ b/content/browser/tracing/tracing_controller_impl.h
@@ -30,11 +30,42 @@ namespace content {
class TraceMessageFilter;
class TracingUI;
+// An implementation of this interface is passed when constructing a
+// TraceDataSink, and receives chunks of the final trace data as it's being
+// constructed.
+// Methods may be called from any thread.
+class TraceDataEndpoint : public base::RefCountedThreadSafe<TraceDataEndpoint> {
+ public:
+ virtual void ReceiveTraceChunk(const std::string& chunk) {}
+ virtual void ReceiveTraceFinalContents(
+ std::unique_ptr<const base::DictionaryValue> metadata,
+ const std::string& contents) {}
+
+ protected:
+ friend class base::RefCountedThreadSafe<TraceDataEndpoint>;
+ virtual ~TraceDataEndpoint() {}
+};
+
class TracingControllerImpl
: public TracingController,
public base::trace_event::MemoryDumpManagerDelegate,
public base::trace_event::TracingAgent {
public:
+ // Create an endpoint that may be supplied to any TraceDataSink to
+ // dump the trace data to a callback.
+ CONTENT_EXPORT static scoped_refptr<TraceDataEndpoint> CreateCallbackEndpoint(
+ const base::Callback<void(std::unique_ptr<const base::DictionaryValue>,
+ base::RefCountedString*)>& callback);
+
+ // Create an endpoint that may be supplied to any TraceDataSink to
+ // dump the trace data to a file.
+ CONTENT_EXPORT static scoped_refptr<TraceDataEndpoint> CreateFileEndpoint(
+ const base::FilePath& file_path,
+ const base::Closure& callback);
+
+ CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateCompressedStringSink(
+ scoped_refptr<TraceDataEndpoint> endpoint);
+
static TracingControllerImpl* GetInstance();
// TracingController implementation.

Powered by Google App Engine
This is Rietveld 408576698