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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_
6 #define CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ 6 #define CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 12 matching lines...) Expand all
23 namespace base { 23 namespace base {
24 class RefCountedString; 24 class RefCountedString;
25 class RefCountedMemory; 25 class RefCountedMemory;
26 } 26 }
27 27
28 namespace content { 28 namespace content {
29 29
30 class TraceMessageFilter; 30 class TraceMessageFilter;
31 class TracingUI; 31 class TracingUI;
32 32
33 // An implementation of this interface is passed when constructing a
34 // TraceDataSink, and receives chunks of the final trace data as it's being
35 // constructed.
36 // Methods may be called from any thread.
37 class TraceDataEndpoint : public base::RefCountedThreadSafe<TraceDataEndpoint> {
38 public:
39 virtual void ReceiveTraceChunk(const std::string& chunk) {}
40 virtual void ReceiveTraceFinalContents(
41 std::unique_ptr<const base::DictionaryValue> metadata,
42 const std::string& contents) {}
43
44 protected:
45 friend class base::RefCountedThreadSafe<TraceDataEndpoint>;
46 virtual ~TraceDataEndpoint() {}
47 };
48
33 class TracingControllerImpl 49 class TracingControllerImpl
34 : public TracingController, 50 : public TracingController,
35 public base::trace_event::MemoryDumpManagerDelegate, 51 public base::trace_event::MemoryDumpManagerDelegate,
36 public base::trace_event::TracingAgent { 52 public base::trace_event::TracingAgent {
37 public: 53 public:
54 // Create an endpoint that may be supplied to any TraceDataSink to
55 // dump the trace data to a callback.
56 CONTENT_EXPORT static scoped_refptr<TraceDataEndpoint> CreateCallbackEndpoint(
57 const base::Callback<void(std::unique_ptr<const base::DictionaryValue>,
58 base::RefCountedString*)>& callback);
59
60 // Create an endpoint that may be supplied to any TraceDataSink to
61 // dump the trace data to a file.
62 CONTENT_EXPORT static scoped_refptr<TraceDataEndpoint> CreateFileEndpoint(
63 const base::FilePath& file_path,
64 const base::Closure& callback);
65
66 CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateCompressedStringSink(
67 scoped_refptr<TraceDataEndpoint> endpoint);
68
38 static TracingControllerImpl* GetInstance(); 69 static TracingControllerImpl* GetInstance();
39 70
40 // TracingController implementation. 71 // TracingController implementation.
41 bool GetCategories(const GetCategoriesDoneCallback& callback) override; 72 bool GetCategories(const GetCategoriesDoneCallback& callback) override;
42 bool StartTracing(const base::trace_event::TraceConfig& trace_config, 73 bool StartTracing(const base::trace_event::TraceConfig& trace_config,
43 const StartTracingDoneCallback& callback) override; 74 const StartTracingDoneCallback& callback) override;
44 bool StopTracing(const scoped_refptr<TraceDataSink>& sink) override; 75 bool StopTracing(const scoped_refptr<TraceDataSink>& sink) override;
45 bool GetTraceBufferUsage( 76 bool GetTraceBufferUsage(
46 const GetTraceBufferUsageCallback& callback) override; 77 const GetTraceBufferUsageCallback& callback) override;
47 bool SetWatchEvent(const std::string& category_name, 78 bool SetWatchEvent(const std::string& category_name,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 std::set<TracingUI*> tracing_uis_; 254 std::set<TracingUI*> tracing_uis_;
224 scoped_refptr<TraceDataSink> trace_data_sink_; 255 scoped_refptr<TraceDataSink> trace_data_sink_;
225 scoped_refptr<TraceDataSink> monitoring_data_sink_; 256 scoped_refptr<TraceDataSink> monitoring_data_sink_;
226 257
227 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); 258 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl);
228 }; 259 };
229 260
230 } // namespace content 261 } // namespace content
231 262
232 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ 263 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698