Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: content/public/browser/tracing_controller.h

Issue 425593002: Refactor trace_event_impl's SetEnabled to use TraceOptions. Propagate this through the whole stack. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pull enable_systrace to TraceOptions Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_TRACING_CONTROLLER_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_
6 #define CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ 6 #define CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/debug/trace_event.h"
12 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
13 14
14 namespace base { 15 namespace base {
15 class FilePath; 16 class FilePath;
16 }; 17 };
17 18
18 namespace content { 19 namespace content {
19 20
20 class TracingController; 21 class TracingController;
21 22
22 // TracingController is used on the browser processes to enable/disable 23 // TracingController is used on the browser processes to enable/disable
23 // trace status and collect trace data. Only the browser UI thread is allowed 24 // trace status and collect trace data. Only the browser UI thread is allowed
24 // to interact with the TracingController object. All callbacks are called on 25 // to interact with the TracingController object. All callbacks are called on
25 // the UI thread. 26 // the UI thread.
26 class TracingController { 27 class TracingController {
27 public: 28 public:
28 enum Options {
29 DEFAULT_OPTIONS = 0,
30 ENABLE_SYSTRACE = 1 << 0,
31 ENABLE_SAMPLING = 1 << 1,
32 RECORD_CONTINUOUSLY = 1 << 2, // For EnableRecording() only.
33 };
34 29
35 CONTENT_EXPORT static TracingController* GetInstance(); 30 CONTENT_EXPORT static TracingController* GetInstance();
36 31
37 // Get a set of category groups. The category groups can change as 32 // Get a set of category groups. The category groups can change as
38 // new code paths are reached. 33 // new code paths are reached.
39 // 34 //
40 // Once all child processes have acked to the GetCategories request, 35 // Once all child processes have acked to the GetCategories request,
41 // GetCategoriesDoneCallback is called back with a set of category 36 // GetCategoriesDoneCallback is called back with a set of category
42 // groups. 37 // groups.
43 typedef base::Callback<void(const std::set<std::string>&)> 38 typedef base::Callback<void(const std::set<std::string>&)>
(...skipping 13 matching lines...) Expand all
57 // traced. A filter can have an optional '-' prefix to exclude category groups 52 // traced. A filter can have an optional '-' prefix to exclude category groups
58 // that contain a matching category. Having both included and excluded 53 // that contain a matching category. Having both included and excluded
59 // category patterns in the same list would not be supported. 54 // category patterns in the same list would not be supported.
60 // 55 //
61 // Examples: "test_MyTest*", 56 // Examples: "test_MyTest*",
62 // "test_MyTest*,test_OtherStuff", 57 // "test_MyTest*,test_OtherStuff",
63 // "-excluded_category1,-excluded_category2" 58 // "-excluded_category1,-excluded_category2"
64 // 59 //
65 // |options| controls what kind of tracing is enabled. 60 // |options| controls what kind of tracing is enabled.
66 typedef base::Callback<void()> EnableRecordingDoneCallback; 61 typedef base::Callback<void()> EnableRecordingDoneCallback;
67 virtual bool EnableRecording( 62 virtual bool EnableRecording(const std::string& category_filter,
68 const std::string& category_filter, 63 base::debug::TraceOptions trace_options,
69 TracingController::Options options, 64 const EnableRecordingDoneCallback& callback) = 0;
70 const EnableRecordingDoneCallback& callback) = 0;
71 65
72 // Stop recording on all processes. 66 // Stop recording on all processes.
73 // 67 //
74 // Child processes typically are caching trace data and only rarely flush 68 // Child processes typically are caching trace data and only rarely flush
75 // and send trace data back to the browser process. That is because it may be 69 // and send trace data back to the browser process. That is because it may be
76 // an expensive operation to send the trace data over IPC, and we would like 70 // an expensive operation to send the trace data over IPC, and we would like
77 // to avoid much runtime overhead of tracing. So, to end tracing, we must 71 // to avoid much runtime overhead of tracing. So, to end tracing, we must
78 // asynchronously ask all child processes to flush any pending trace data. 72 // asynchronously ask all child processes to flush any pending trace data.
79 // 73 //
80 // Once all child processes have acked to the DisableRecording request, 74 // Once all child processes have acked to the DisableRecording request,
(...skipping 18 matching lines...) Expand all
99 // Once all child processes have acked to the EnableMonitoring request, 93 // Once all child processes have acked to the EnableMonitoring request,
100 // EnableMonitoringDoneCallback will be called back. 94 // EnableMonitoringDoneCallback will be called back.
101 // 95 //
102 // |category_filter| is a filter to control what category groups should be 96 // |category_filter| is a filter to control what category groups should be
103 // traced. 97 // traced.
104 // 98 //
105 // |options| controls what kind of tracing is enabled. 99 // |options| controls what kind of tracing is enabled.
106 typedef base::Callback<void()> EnableMonitoringDoneCallback; 100 typedef base::Callback<void()> EnableMonitoringDoneCallback;
107 virtual bool EnableMonitoring( 101 virtual bool EnableMonitoring(
108 const std::string& category_filter, 102 const std::string& category_filter,
109 TracingController::Options options, 103 base::debug::TraceOptions trace_options,
110 const EnableMonitoringDoneCallback& callback) = 0; 104 const EnableMonitoringDoneCallback& callback) = 0;
111 105
112 // Stop monitoring on all processes. 106 // Stop monitoring on all processes.
113 // 107 //
114 // Once all child processes have acked to the DisableMonitoring request, 108 // Once all child processes have acked to the DisableMonitoring request,
115 // DisableMonitoringDoneCallback is called back. 109 // DisableMonitoringDoneCallback is called back.
116 typedef base::Callback<void()> DisableMonitoringDoneCallback; 110 typedef base::Callback<void()> DisableMonitoringDoneCallback;
117 virtual bool DisableMonitoring( 111 virtual bool DisableMonitoring(
118 const DisableMonitoringDoneCallback& callback) = 0; 112 const DisableMonitoringDoneCallback& callback) = 0;
119 113
120 // Get the current monitoring configuration. 114 // Get the current monitoring configuration.
121 virtual void GetMonitoringStatus(bool* out_enabled, 115 virtual void GetMonitoringStatus(
122 std::string* out_category_filter, 116 bool* out_enabled,
123 TracingController::Options* out_options) = 0; 117 std::string* out_category_filter,
118 base::debug::TraceOptions* out_trace_options) = 0;
124 119
125 // Get the current monitoring traced data. 120 // Get the current monitoring traced data.
126 // 121 //
127 // Child processes typically are caching trace data and only rarely flush 122 // Child processes typically are caching trace data and only rarely flush
128 // and send trace data back to the browser process. That is because it may be 123 // and send trace data back to the browser process. That is because it may be
129 // an expensive operation to send the trace data over IPC, and we would like 124 // an expensive operation to send the trace data over IPC, and we would like
130 // to avoid much runtime overhead of tracing. So, to end tracing, we must 125 // to avoid much runtime overhead of tracing. So, to end tracing, we must
131 // asynchronously ask all child processes to flush any pending trace data. 126 // asynchronously ask all child processes to flush any pending trace data.
132 // 127 //
133 // Once all child processes have acked to the CaptureMonitoringSnapshot 128 // Once all child processes have acked to the CaptureMonitoringSnapshot
(...skipping 27 matching lines...) Expand all
161 // watch event callback. 156 // watch event callback.
162 virtual bool CancelWatchEvent() = 0; 157 virtual bool CancelWatchEvent() = 0;
163 158
164 protected: 159 protected:
165 virtual ~TracingController() {} 160 virtual ~TracingController() {}
166 }; 161 };
167 162
168 } // namespace content 163 } // namespace content
169 164
170 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ 165 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698