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 "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 // | 24 // |
25 // Currently only one subscriber is allowed at a time. | 25 // Currently only one subscriber is allowed at a time. |
26 // Tracing begins immediately locally, and asynchronously on child processes | 26 // Tracing begins immediately locally, and asynchronously on child processes |
27 // as soon as they receive the BeginTracing request. | 27 // as soon as they receive the BeginTracing request. |
28 // | 28 // |
29 // If BeginTracing was already called previously, | 29 // If BeginTracing was already called previously, |
30 // or if an EndTracingAsync is pending, | 30 // or if an EndTracingAsync is pending, |
31 // or if another subscriber is tracing, | 31 // or if another subscriber is tracing, |
32 // BeginTracing will return false meaning it failed. | 32 // BeginTracing will return false meaning it failed. |
33 // | 33 // |
34 // |categories| is a comma-delimited list of category wildcards. | 34 // |category_patterns| is a comma-delimited list of category wildcards. |
35 // A category can have an optional '-' prefix to make it an excluded category. | 35 // A category pattern can have an optional '-' prefix to exclude category |
| 36 // groups that contain a matching category. |
36 // All the same rules apply above, so for example, having both included and | 37 // All the same rules apply above, so for example, having both included and |
37 // excluded categories in the same list would not be supported. | 38 // excluded category patterns in the same list would not be supported. |
38 // | 39 // |
39 // |mode| is the tracing mode being used. | 40 // |mode| is the tracing mode being used. |
40 // | 41 // |
41 // Example: BeginTracing("test_MyTest*"); | 42 // Example: BeginTracing("test_MyTest*"); |
42 // Example: BeginTracing("test_MyTest*,test_OtherStuff"); | 43 // Example: BeginTracing("test_MyTest*,test_OtherStuff"); |
43 // Example: BeginTracing("-excluded_category1,-excluded_category2"); | 44 // Example: BeginTracing("-excluded_category1,-excluded_category2"); |
44 virtual bool BeginTracing(TraceSubscriber* subscriber, | 45 virtual bool BeginTracing(TraceSubscriber* subscriber, |
45 const std::string& categories, | 46 const std::string& category_patterns, |
46 base::debug::TraceLog::Options options) = 0; | 47 base::debug::TraceLog::Options options) = 0; |
47 | 48 |
48 // Called by browser process to stop tracing events on all processes. | 49 // Called by browser process to stop tracing events on all processes. |
49 // | 50 // |
50 // Child processes typically are caching trace data and only rarely flush | 51 // Child processes typically are caching trace data and only rarely flush |
51 // and send trace data back to the browser process. That is because it may be | 52 // and send trace data back to the browser process. That is because it may be |
52 // an expensive operation to send the trace data over IPC, and we would like | 53 // an expensive operation to send the trace data over IPC, and we would like |
53 // to avoid much runtime overhead of tracing. So, to end tracing, we must | 54 // to avoid much runtime overhead of tracing. So, to end tracing, we must |
54 // asynchronously ask all child processes to flush any pending trace data. | 55 // asynchronously ask all child processes to flush any pending trace data. |
55 // | 56 // |
(...skipping 25 matching lines...) Expand all Loading... |
81 // Cancel the watch event. If tracing is enabled, this may race with the | 82 // Cancel the watch event. If tracing is enabled, this may race with the |
82 // watch event notification firing. | 83 // watch event notification firing. |
83 virtual bool CancelWatchEvent(TraceSubscriber* subscriber) = 0; | 84 virtual bool CancelWatchEvent(TraceSubscriber* subscriber) = 0; |
84 | 85 |
85 // Cancel the subscriber so that it will not be called when EndTracingAsync is | 86 // Cancel the subscriber so that it will not be called when EndTracingAsync is |
86 // acked by all child processes. This will also call EndTracingAsync | 87 // acked by all child processes. This will also call EndTracingAsync |
87 // internally if necessary. | 88 // internally if necessary. |
88 // Safe to call even if caller is not the current subscriber. | 89 // Safe to call even if caller is not the current subscriber. |
89 virtual void CancelSubscriber(TraceSubscriber* subscriber) = 0; | 90 virtual void CancelSubscriber(TraceSubscriber* subscriber) = 0; |
90 | 91 |
91 // Get set of known categories. This can change as new code paths are reached. | 92 // Get set of known category groups. This can change as new code paths are |
92 // If true is returned, subscriber->OnKnownCategoriesCollected will be called | 93 // reached. If true is returned, subscriber->OnKnownCategoriesCollected will |
93 // once the categories are retrieved from child processes. | 94 // be called once the categories are retrieved from child processes. |
94 virtual bool GetKnownCategoriesAsync(TraceSubscriber* subscriber) = 0; | 95 virtual bool GetKnownCategoryGroupsAsync(TraceSubscriber* subscriber) = 0; |
95 | 96 |
96 protected: | 97 protected: |
97 virtual ~TraceController() {} | 98 virtual ~TraceController() {} |
98 }; | 99 }; |
99 | 100 |
100 } // namespace content | 101 } // namespace content |
101 | 102 |
102 #endif // CONTENT_PUBLIC_BROWSER_TRACE_CONTROLLER_H_ | 103 #endif // CONTENT_PUBLIC_BROWSER_TRACE_CONTROLLER_H_ |
103 | 104 |
OLD | NEW |