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