OLD | NEW |
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 | 10 |
| 11 #include "base/debug/trace_event.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
13 #include "base/task.h" | 14 #include "base/task.h" |
14 | 15 |
15 class TraceMessageFilter; | 16 class TraceMessageFilter; |
16 | 17 |
17 // Objects interested in receiving trace data derive from TraceSubscriber. | 18 // Objects interested in receiving trace data derive from TraceSubscriber. |
18 // See also: trace_message_filter.h | 19 // See also: trace_message_filter.h |
19 // See also: child_trace_message_filter.h | 20 // See also: child_trace_message_filter.h |
20 class TraceSubscriber { | 21 class TraceSubscriber { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 104 |
104 bool can_begin_tracing() const { return !is_tracing_; } | 105 bool can_begin_tracing() const { return !is_tracing_; } |
105 | 106 |
106 // Methods for use by TraceMessageFilter. | 107 // Methods for use by TraceMessageFilter. |
107 | 108 |
108 // Passing as scoped_refptr so that the method can be run asynchronously as | 109 // Passing as scoped_refptr so that the method can be run asynchronously as |
109 // a task safely (otherwise the TraceMessageFilter could be destructed). | 110 // a task safely (otherwise the TraceMessageFilter could be destructed). |
110 void AddFilter(TraceMessageFilter* filter); | 111 void AddFilter(TraceMessageFilter* filter); |
111 void RemoveFilter(TraceMessageFilter* filter); | 112 void RemoveFilter(TraceMessageFilter* filter); |
112 void OnEndTracingAck(); | 113 void OnEndTracingAck(); |
113 void OnTraceDataCollected(const std::string& data); | 114 void OnTraceDataCollected( |
| 115 const scoped_refptr<base::debug::TraceLog::RefCountedString>& |
| 116 json_events_str_ptr); |
114 void OnTraceBufferFull(); | 117 void OnTraceBufferFull(); |
115 void OnTraceBufferPercentFullReply(float percent_full); | 118 void OnTraceBufferPercentFullReply(float percent_full); |
116 | 119 |
117 FilterMap filters_; | 120 FilterMap filters_; |
118 TraceSubscriber* subscriber_; | 121 TraceSubscriber* subscriber_; |
119 // Pending acks for EndTracingAsync: | 122 // Pending acks for EndTracingAsync: |
120 int pending_end_ack_count_; | 123 int pending_end_ack_count_; |
121 // Pending acks for GetTraceBufferPercentFullAsync: | 124 // Pending acks for GetTraceBufferPercentFullAsync: |
122 int pending_bpf_ack_count_; | 125 int pending_bpf_ack_count_; |
123 float maximum_bpf_; | 126 float maximum_bpf_; |
124 bool is_tracing_; | 127 bool is_tracing_; |
125 | 128 |
126 DISALLOW_COPY_AND_ASSIGN(TraceController); | 129 DISALLOW_COPY_AND_ASSIGN(TraceController); |
127 }; | 130 }; |
128 | 131 |
129 DISABLE_RUNNABLE_METHOD_REFCOUNT(TraceController); | 132 DISABLE_RUNNABLE_METHOD_REFCOUNT(TraceController); |
130 | 133 |
131 #endif // CONTENT_BROWSER_TRACE_CONTROLLER_H_ | 134 #endif // CONTENT_BROWSER_TRACE_CONTROLLER_H_ |
132 | 135 |
OLD | NEW |