OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TRACE_CONTROLLER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_TRACE_CONTROLLER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_TRACE_CONTROLLER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_TRACE_CONTROLLER_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 class TraceSubscriber; | 12 class TraceSubscriber; |
13 | 13 |
14 // TraceController is used on the browser processes to enable/disable | 14 // TraceController is used on the browser processes to enable/disable |
15 // trace status and collect trace data. Only the browser UI thread is allowed | 15 // trace status and collect trace data. Only the browser UI thread is allowed |
16 // to interact with the TraceController object. All calls on the TraceSubscriber | 16 // to interact with the TraceController object. All calls on the TraceSubscriber |
17 // happen on the UI thread. | 17 // happen on the UI thread. |
18 class TraceController { | 18 class TraceController { |
19 public: | 19 public: |
20 CONTENT_EXPORT static TraceController* GetInstance(); | 20 CONTENT_EXPORT static TraceController* GetInstance(); |
21 | 21 |
22 // Called by browser process to start tracing events on all processes. | 22 // Called by browser process to start tracing events on all processes. |
23 // | 23 // |
24 // Currently only one subscriber is allowed at a time. | 24 // Currently only one subscriber is allowed at a time. |
25 // Tracing begins immediately locally, and asynchronously on child processes | 25 // Tracing begins immediately locally, and asynchronously on child processes |
26 // as soon as they receive the BeginTracing request. | 26 // as soon as they receive the BeginTracing request. |
27 // By default, all categories are traced except those matching "test_*". | |
28 // | 27 // |
29 // If BeginTracing was already called previously, | 28 // If BeginTracing was already called previously, |
30 // or if an EndTracingAsync is pending, | 29 // or if an EndTracingAsync is pending, |
31 // or if another subscriber is tracing, | 30 // or if another subscriber is tracing, |
32 // BeginTracing will return false meaning it failed. | 31 // BeginTracing will return false meaning it failed. |
33 virtual bool BeginTracing(TraceSubscriber* subscriber) = 0; | 32 // |
34 | |
35 // |categories| is a comma-delimited list of category wildcards. | 33 // |categories| is a comma-delimited list of category wildcards. |
36 // A category can have an optional '-' prefix to make it an excluded category. | 34 // A category can have an optional '-' prefix to make it an excluded category. |
37 // All the same rules apply above, so for example, having both included and | 35 // All the same rules apply above, so for example, having both included and |
38 // excluded categories in the same list would not be supported. | 36 // excluded categories in the same list would not be supported. |
39 // | 37 // |
40 // Example: BeginTracing("test_MyTest*"); | 38 // Example: BeginTracing("test_MyTest*"); |
41 // Example: BeginTracing("test_MyTest*,test_OtherStuff"); | 39 // Example: BeginTracing("test_MyTest*,test_OtherStuff"); |
42 // Example: BeginTracing("-excluded_category1,-excluded_category2"); | 40 // Example: BeginTracing("-excluded_category1,-excluded_category2"); |
43 virtual bool BeginTracing(TraceSubscriber* subscriber, | 41 virtual bool BeginTracing(TraceSubscriber* subscriber, |
44 const std::string& categories) = 0; | 42 const std::string& categories) = 0; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 virtual void CancelSubscriber(TraceSubscriber* subscriber) = 0; | 75 virtual void CancelSubscriber(TraceSubscriber* subscriber) = 0; |
78 | 76 |
79 protected: | 77 protected: |
80 virtual ~TraceController() {} | 78 virtual ~TraceController() {} |
81 }; | 79 }; |
82 | 80 |
83 } // namespace content | 81 } // namespace content |
84 | 82 |
85 #endif // CONTENT_PUBLIC_BROWSER_TRACE_CONTROLLER_H_ | 83 #endif // CONTENT_PUBLIC_BROWSER_TRACE_CONTROLLER_H_ |
86 | 84 |
OLD | NEW |