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

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: 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 15 matching lines...) Expand all
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(
68 const std::string& category_filter, 63 const std::string& category_filter,
69 TracingController::Options options, 64 base::debug::TraceOptions trace_options,
65 bool enable_systrace,
70 const EnableRecordingDoneCallback& callback) = 0; 66 const EnableRecordingDoneCallback& callback) = 0;
71 67
72 // Stop recording on all processes. 68 // Stop recording on all processes.
73 // 69 //
74 // Child processes typically are caching trace data and only rarely flush 70 // 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 71 // 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 72 // 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 73 // 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. 74 // asynchronously ask all child processes to flush any pending trace data.
79 // 75 //
(...skipping 19 matching lines...) Expand all
99 // Once all child processes have acked to the EnableMonitoring request, 95 // Once all child processes have acked to the EnableMonitoring request,
100 // EnableMonitoringDoneCallback will be called back. 96 // EnableMonitoringDoneCallback will be called back.
101 // 97 //
102 // |category_filter| is a filter to control what category groups should be 98 // |category_filter| is a filter to control what category groups should be
103 // traced. 99 // traced.
104 // 100 //
105 // |options| controls what kind of tracing is enabled. 101 // |options| controls what kind of tracing is enabled.
106 typedef base::Callback<void()> EnableMonitoringDoneCallback; 102 typedef base::Callback<void()> EnableMonitoringDoneCallback;
107 virtual bool EnableMonitoring( 103 virtual bool EnableMonitoring(
108 const std::string& category_filter, 104 const std::string& category_filter,
109 TracingController::Options options, 105 base::debug::TraceOptions trace_options,
110 const EnableMonitoringDoneCallback& callback) = 0; 106 const EnableMonitoringDoneCallback& callback) = 0;
111 107
112 // Stop monitoring on all processes. 108 // Stop monitoring on all processes.
113 // 109 //
114 // Once all child processes have acked to the DisableMonitoring request, 110 // Once all child processes have acked to the DisableMonitoring request,
115 // DisableMonitoringDoneCallback is called back. 111 // DisableMonitoringDoneCallback is called back.
116 typedef base::Callback<void()> DisableMonitoringDoneCallback; 112 typedef base::Callback<void()> DisableMonitoringDoneCallback;
117 virtual bool DisableMonitoring( 113 virtual bool DisableMonitoring(
118 const DisableMonitoringDoneCallback& callback) = 0; 114 const DisableMonitoringDoneCallback& callback) = 0;
119 115
120 // Get the current monitoring configuration. 116 // Get the current monitoring configuration.
121 virtual void GetMonitoringStatus(bool* out_enabled, 117 virtual void GetMonitoringStatus(bool* out_enabled,
122 std::string* out_category_filter, 118 std::string* out_category_filter,
123 TracingController::Options* out_options) = 0; 119 base::debug::TraceOptions* out_trace_options,
120 bool* out_enable_systrace) = 0;
124 121
125 // Get the current monitoring traced data. 122 // Get the current monitoring traced data.
126 // 123 //
127 // Child processes typically are caching trace data and only rarely flush 124 // 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 125 // 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 126 // 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 127 // 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. 128 // asynchronously ask all child processes to flush any pending trace data.
132 // 129 //
133 // Once all child processes have acked to the CaptureMonitoringSnapshot 130 // Once all child processes have acked to the CaptureMonitoringSnapshot
(...skipping 27 matching lines...) Expand all
161 // watch event callback. 158 // watch event callback.
162 virtual bool CancelWatchEvent() = 0; 159 virtual bool CancelWatchEvent() = 0;
163 160
164 protected: 161 protected:
165 virtual ~TracingController() {} 162 virtual ~TracingController() {}
166 }; 163 };
167 164
168 } // namespace content 165 } // namespace content
169 166
170 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ 167 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698