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

Side by Side Diff: content/public/browser/tracing_controller.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
« no previous file with comments | « content/browser/tracing/tracing_ui.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 virtual const std::map<std::string, std::string>& GetAgentTrace() const; 67 virtual const std::map<std::string, std::string>& GetAgentTrace() const;
68 68
69 virtual ~TraceDataSink(); 69 virtual ~TraceDataSink();
70 70
71 private: 71 private:
72 std::map<std::string, std::string> additional_tracing_agent_trace_; 72 std::map<std::string, std::string> additional_tracing_agent_trace_;
73 MetadataFilterPredicate metadata_filter_predicate_; 73 MetadataFilterPredicate metadata_filter_predicate_;
74 base::DictionaryValue metadata_; 74 base::DictionaryValue metadata_;
75 }; 75 };
76 76
77 // An implementation of this interface is passed when constructing a
78 // TraceDataSink, and receives chunks of the final trace data as it's being
79 // constructed.
80 // Methods may be called from any thread.
81 class CONTENT_EXPORT TraceDataEndpoint
82 : public base::RefCountedThreadSafe<TraceDataEndpoint> {
83 public:
84 virtual void ReceiveTraceChunk(const std::string& chunk) {}
85 virtual void ReceiveTraceFinalContents(
86 std::unique_ptr<const base::DictionaryValue> metadata,
87 const std::string& contents) {}
88
89 protected:
90 friend class base::RefCountedThreadSafe<TraceDataEndpoint>;
91 virtual ~TraceDataEndpoint() {}
92 };
93
94 // Create a trace sink that may be supplied to StopTracing 77 // Create a trace sink that may be supplied to StopTracing
95 // to capture the trace data as a string. 78 // to capture the trace data as a string.
96 CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateStringSink( 79 CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateStringSink(
97 const base::Callback<void(std::unique_ptr<const base::DictionaryValue>, 80 const base::Callback<void(std::unique_ptr<const base::DictionaryValue>,
98 base::RefCountedString*)>& callback); 81 base::RefCountedString*)>& callback);
99 82
100 CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateCompressedStringSink(
101 scoped_refptr<TraceDataEndpoint> endpoint);
102
103 // Create a trace sink that may be supplied to StopTracing 83 // Create a trace sink that may be supplied to StopTracing
104 // to dump the trace data to a file. 84 // to dump the trace data to a file.
105 CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateFileSink( 85 CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateFileSink(
106 const base::FilePath& file_path, 86 const base::FilePath& file_path,
107 const base::Closure& callback); 87 const base::Closure& callback);
108 88
109 // Create an endpoint that may be supplied to any TraceDataSink to
110 // dump the trace data to a callback.
111 CONTENT_EXPORT static scoped_refptr<TraceDataEndpoint> CreateCallbackEndpoint(
112 const base::Callback<void(std::unique_ptr<const base::DictionaryValue>,
113 base::RefCountedString*)>& callback);
114
115 // Create an endpoint that may be supplied to any TraceDataSink to
116 // dump the trace data to a file.
117 CONTENT_EXPORT static scoped_refptr<TraceDataEndpoint> CreateFileEndpoint(
118 const base::FilePath& file_path,
119 const base::Closure& callback);
120
121 // Get a set of category groups. The category groups can change as 89 // Get a set of category groups. The category groups can change as
122 // new code paths are reached. 90 // new code paths are reached.
123 // 91 //
124 // Once all child processes have acked to the GetCategories request, 92 // Once all child processes have acked to the GetCategories request,
125 // GetCategoriesDoneCallback is called back with a set of category 93 // GetCategoriesDoneCallback is called back with a set of category
126 // groups. 94 // groups.
127 typedef base::Callback<void(const std::set<std::string>&)> 95 typedef base::Callback<void(const std::set<std::string>&)>
128 GetCategoriesDoneCallback; 96 GetCategoriesDoneCallback;
129 virtual bool GetCategories( 97 virtual bool GetCategories(
130 const GetCategoriesDoneCallback& callback) = 0; 98 const GetCategoriesDoneCallback& callback) = 0;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Check if the tracing system is tracing 160 // Check if the tracing system is tracing
193 virtual bool IsTracing() const = 0; 161 virtual bool IsTracing() const = 0;
194 162
195 protected: 163 protected:
196 virtual ~TracingController() {} 164 virtual ~TracingController() {}
197 }; 165 };
198 166
199 } // namespace content 167 } // namespace content
200 168
201 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ 169 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_
OLDNEW
« no previous file with comments | « content/browser/tracing/tracing_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698