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 "content/common/content_export.h" | |
darin (slow to review)
2011/09/04 15:41:04
nit: "base" before "content"
Dirk Pranke
2011/09/07 01:46:07
Done.
| |
11 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
14 #include "base/task.h" | 15 #include "base/task.h" |
15 | 16 |
16 class TraceMessageFilter; | 17 class TraceMessageFilter; |
17 | 18 |
18 // Objects interested in receiving trace data derive from TraceSubscriber. | 19 // Objects interested in receiving trace data derive from TraceSubscriber. |
19 // See also: trace_message_filter.h | 20 // See also: trace_message_filter.h |
20 // See also: child_trace_message_filter.h | 21 // See also: child_trace_message_filter.h |
21 class TraceSubscriber { | 22 class TraceSubscriber { |
22 public: | 23 public: |
23 virtual void OnEndTracingComplete() = 0; | 24 virtual void OnEndTracingComplete() = 0; |
24 virtual void OnTraceDataCollected(const std::string& json_events) = 0; | 25 virtual void OnTraceDataCollected(const std::string& json_events) = 0; |
25 virtual void OnTraceBufferPercentFullReply(float percent_full) {} | 26 virtual void OnTraceBufferPercentFullReply(float percent_full) {} |
26 }; | 27 }; |
27 | 28 |
28 // TraceController is used on the browser processes to enable/disable | 29 // TraceController is used on the browser processes to enable/disable |
29 // trace status and collect trace data. Only the browser UI thread is allowed | 30 // trace status and collect trace data. Only the browser UI thread is allowed |
30 // to interact with the TraceController object. All calls on the TraceSubscriber | 31 // to interact with the TraceController object. All calls on the TraceSubscriber |
31 // happen on the UI thread. | 32 // happen on the UI thread. |
32 class TraceController { | 33 class CONTENT_EXPORT TraceController { |
33 public: | 34 public: |
34 static TraceController* GetInstance(); | 35 static TraceController* GetInstance(); |
35 | 36 |
36 // Called by browser process to start tracing events on all processes. | 37 // Called by browser process to start tracing events on all processes. |
37 // | 38 // |
38 // Currently only one subscriber is allowed at a time. | 39 // Currently only one subscriber is allowed at a time. |
39 // Tracing begins immediately locally, and asynchronously on child processes | 40 // Tracing begins immediately locally, and asynchronously on child processes |
40 // as soon as they receive the BeginTracing request. | 41 // as soon as they receive the BeginTracing request. |
41 // | 42 // |
42 // If BeginTracing was already called previously, | 43 // If BeginTracing was already called previously, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 float maximum_bpf_; | 127 float maximum_bpf_; |
127 bool is_tracing_; | 128 bool is_tracing_; |
128 | 129 |
129 DISALLOW_COPY_AND_ASSIGN(TraceController); | 130 DISALLOW_COPY_AND_ASSIGN(TraceController); |
130 }; | 131 }; |
131 | 132 |
132 DISABLE_RUNNABLE_METHOD_REFCOUNT(TraceController); | 133 DISABLE_RUNNABLE_METHOD_REFCOUNT(TraceController); |
133 | 134 |
134 #endif // CONTENT_BROWSER_TRACE_CONTROLLER_H_ | 135 #endif // CONTENT_BROWSER_TRACE_CONTROLLER_H_ |
135 | 136 |
OLD | NEW |