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

Side by Side Diff: content/browser/trace_controller.h

Issue 8373018: Internalize JSON chunk merging to trace_event.h API (retry). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more BASE_EXPORT Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/tracing_ui.cc ('k') | content/browser/trace_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_TRACE_CONTROLLER_H_ 5 #ifndef CONTENT_BROWSER_TRACE_CONTROLLER_H_
6 #define CONTENT_BROWSER_TRACE_CONTROLLER_H_ 6 #define CONTENT_BROWSER_TRACE_CONTROLLER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 15
16 class TraceMessageFilter; 16 class TraceMessageFilter;
17 17
18 // Objects interested in receiving trace data derive from TraceSubscriber. 18 // Objects interested in receiving trace data derive from TraceSubscriber.
19 // See also: trace_message_filter.h 19 // See also: trace_message_filter.h
20 // See also: child_trace_message_filter.h 20 // See also: child_trace_message_filter.h
21 class CONTENT_EXPORT TraceSubscriber { 21 class CONTENT_EXPORT TraceSubscriber {
22 public: 22 public:
23 // Called once after TraceController::EndTracingAsync. 23 // Called once after TraceController::EndTracingAsync.
24 virtual void OnEndTracingComplete() = 0; 24 virtual void OnEndTracingComplete() = 0;
25 // Called 0 or more times between TraceController::BeginTracing and 25 // Called 0 or more times between TraceController::BeginTracing and
26 // OnEndTracingComplete. 26 // OnEndTracingComplete. Use base::debug::TraceResultBuffer to convert one or
27 virtual void OnTraceDataCollected(const std::string& json_events) = 0; 27 // more trace fragments to JSON.
28 virtual void OnTraceDataCollected(const std::string& trace_fragment) = 0;
28 // Called once after TraceController::GetKnownCategoriesAsync. 29 // Called once after TraceController::GetKnownCategoriesAsync.
29 virtual void OnKnownCategoriesCollected( 30 virtual void OnKnownCategoriesCollected(
30 const std::set<std::string>& known_categories) {} 31 const std::set<std::string>& known_categories) {}
31 virtual void OnTraceBufferPercentFullReply(float percent_full) {} 32 virtual void OnTraceBufferPercentFullReply(float percent_full) {}
32 }; 33 };
33 34
34 // TraceController is used on the browser processes to enable/disable 35 // TraceController is used on the browser processes to enable/disable
35 // trace status and collect trace data. Only the browser UI thread is allowed 36 // trace status and collect trace data. Only the browser UI thread is allowed
36 // to interact with the TraceController object. All calls on the TraceSubscriber 37 // to interact with the TraceController object. All calls on the TraceSubscriber
37 // happen on the UI thread. 38 // happen on the UI thread.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 128
128 // Methods for use by TraceMessageFilter. 129 // Methods for use by TraceMessageFilter.
129 130
130 // Passing as scoped_refptr so that the method can be run asynchronously as 131 // Passing as scoped_refptr so that the method can be run asynchronously as
131 // a task safely (otherwise the TraceMessageFilter could be destructed). 132 // a task safely (otherwise the TraceMessageFilter could be destructed).
132 void AddFilter(TraceMessageFilter* filter); 133 void AddFilter(TraceMessageFilter* filter);
133 void RemoveFilter(TraceMessageFilter* filter); 134 void RemoveFilter(TraceMessageFilter* filter);
134 void OnEndTracingAck(const std::vector<std::string>& known_categories); 135 void OnEndTracingAck(const std::vector<std::string>& known_categories);
135 void OnTraceDataCollected( 136 void OnTraceDataCollected(
136 const scoped_refptr<base::debug::TraceLog::RefCountedString>& 137 const scoped_refptr<base::debug::TraceLog::RefCountedString>&
137 json_events_str_ptr); 138 events_str_ptr);
138 void OnTraceBufferFull(); 139 void OnTraceBufferFull();
139 void OnTraceBufferPercentFullReply(float percent_full); 140 void OnTraceBufferPercentFullReply(float percent_full);
140 141
141 FilterMap filters_; 142 FilterMap filters_;
142 TraceSubscriber* subscriber_; 143 TraceSubscriber* subscriber_;
143 // Pending acks for EndTracingAsync: 144 // Pending acks for EndTracingAsync:
144 int pending_end_ack_count_; 145 int pending_end_ack_count_;
145 // Pending acks for GetTraceBufferPercentFullAsync: 146 // Pending acks for GetTraceBufferPercentFullAsync:
146 int pending_bpf_ack_count_; 147 int pending_bpf_ack_count_;
147 float maximum_bpf_; 148 float maximum_bpf_;
148 bool is_tracing_; 149 bool is_tracing_;
149 bool is_get_categories_; 150 bool is_get_categories_;
150 std::set<std::string> known_categories_; 151 std::set<std::string> known_categories_;
151 std::vector<std::string> included_categories_; 152 std::vector<std::string> included_categories_;
152 std::vector<std::string> excluded_categories_; 153 std::vector<std::string> excluded_categories_;
153 154
154 DISALLOW_COPY_AND_ASSIGN(TraceController); 155 DISALLOW_COPY_AND_ASSIGN(TraceController);
155 }; 156 };
156 157
157 #endif // CONTENT_BROWSER_TRACE_CONTROLLER_H_ 158 #endif // CONTENT_BROWSER_TRACE_CONTROLLER_H_
158 159
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/tracing_ui.cc ('k') | content/browser/trace_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698