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

Side by Side Diff: content/browser/tracing/tracing_controller_impl.h

Issue 1468173003: [Tracing Clock Sync] Add TracingAgent interface in Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile failure for cros Created 5 years 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_
6 #define CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ 6 #define CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/trace_event/memory_dump_manager.h" 13 #include "base/trace_event/memory_dump_manager.h"
14 #include "base/trace_event/tracing_agent.h"
14 #include "content/public/browser/tracing_controller.h" 15 #include "content/public/browser/tracing_controller.h"
15 16
16 namespace base { 17 namespace base {
17 class RefCountedString; 18 class RefCountedString;
18 class RefCountedMemory; 19 class RefCountedMemory;
19 } 20 }
20 21
21 namespace content { 22 namespace content {
22 23
23 class TraceMessageFilter; 24 class TraceMessageFilter;
24 class TracingUI; 25 class TracingUI;
25 26
26 class TracingControllerImpl 27 class TracingControllerImpl
27 : public TracingController, 28 : public TracingController,
28 public base::trace_event::MemoryDumpManagerDelegate { 29 public base::trace_event::MemoryDumpManagerDelegate,
30 public base::trace_event::TracingAgent {
29 public: 31 public:
30 static TracingControllerImpl* GetInstance(); 32 static TracingControllerImpl* GetInstance();
31 33
32 // TracingController implementation. 34 // TracingController implementation.
33 bool GetCategories(const GetCategoriesDoneCallback& callback) override; 35 bool GetCategories(const GetCategoriesDoneCallback& callback) override;
34 bool StartTracing(const base::trace_event::TraceConfig& trace_config, 36 bool StartTracing(const base::trace_event::TraceConfig& trace_config,
35 const StartTracingDoneCallback& callback) override; 37 const StartTracingDoneCallback& callback) override;
36 bool StopTracing(const scoped_refptr<TraceDataSink>& sink) override; 38 bool StopTracing(const scoped_refptr<TraceDataSink>& sink) override;
37 bool StartMonitoring( 39 bool StartMonitoring(
38 const base::trace_event::TraceConfig& trace_config, 40 const base::trace_event::TraceConfig& trace_config,
39 const StartMonitoringDoneCallback& callback) override; 41 const StartMonitoringDoneCallback& callback) override;
40 bool StopMonitoring( 42 bool StopMonitoring(
41 const StopMonitoringDoneCallback& callback) override; 43 const StopMonitoringDoneCallback& callback) override;
42 void GetMonitoringStatus( 44 void GetMonitoringStatus(
43 bool* out_enabled, 45 bool* out_enabled,
44 base::trace_event::TraceConfig* out_trace_config) override; 46 base::trace_event::TraceConfig* out_trace_config) override;
45 bool CaptureMonitoringSnapshot( 47 bool CaptureMonitoringSnapshot(
46 const scoped_refptr<TraceDataSink>& sink) override; 48 const scoped_refptr<TraceDataSink>& sink) override;
47 bool GetTraceBufferUsage( 49 bool GetTraceBufferUsage(
48 const GetTraceBufferUsageCallback& callback) override; 50 const GetTraceBufferUsageCallback& callback) override;
49 bool SetWatchEvent(const std::string& category_name, 51 bool SetWatchEvent(const std::string& category_name,
50 const std::string& event_name, 52 const std::string& event_name,
51 const WatchEventCallback& callback) override; 53 const WatchEventCallback& callback) override;
52 bool CancelWatchEvent() override; 54 bool CancelWatchEvent() override;
53 bool IsTracing() const override; 55 bool IsTracing() const override;
54 56
55 void RegisterTracingUI(TracingUI* tracing_ui); 57 void RegisterTracingUI(TracingUI* tracing_ui);
56 void UnregisterTracingUI(TracingUI* tracing_ui); 58 void UnregisterTracingUI(TracingUI* tracing_ui);
57 59
60 // base::trace_event::TracingAgent implementation.
61 std::string GetTracingAgentName() override;
62 bool StartAgentTracing(
63 const base::trace_event::TraceConfig& trace_config) override;
64 void StopAgentTracing(const StopAgentTracingCallback& callback) override;
65 bool SupportsExplicitClockSync() override;
66 void RecordClockSyncMarker(
67 scoped_ptr<base::DictionaryValue> marker) override;
68 void IssueClockSyncMarker() override;
69
58 // base::trace_event::MemoryDumpManagerDelegate implementation. 70 // base::trace_event::MemoryDumpManagerDelegate implementation.
59 void RequestGlobalMemoryDump( 71 void RequestGlobalMemoryDump(
60 const base::trace_event::MemoryDumpRequestArgs& args, 72 const base::trace_event::MemoryDumpRequestArgs& args,
61 const base::trace_event::MemoryDumpCallback& callback) override; 73 const base::trace_event::MemoryDumpCallback& callback) override;
62 uint64 GetTracingProcessId() const override; 74 uint64 GetTracingProcessId() const override;
63 75
64 class TraceMessageFilterObserver { 76 class TraceMessageFilterObserver {
65 public: 77 public:
66 virtual void OnTraceMessageFilterAdded(TraceMessageFilter* filter) = 0; 78 virtual void OnTraceMessageFilterAdded(TraceMessageFilter* filter) = 0;
67 virtual void OnTraceMessageFilterRemoved(TraceMessageFilter* filter) = 0; 79 virtual void OnTraceMessageFilterRemoved(TraceMessageFilter* filter) = 0;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 bool has_more_events); 127 bool has_more_events);
116 // Callback of TraceLog::FlushMonitoring() for the local trace. 128 // Callback of TraceLog::FlushMonitoring() for the local trace.
117 void OnLocalMonitoringTraceDataCollected( 129 void OnLocalMonitoringTraceDataCollected(
118 const scoped_refptr<base::RefCountedString>& events_str_ptr, 130 const scoped_refptr<base::RefCountedString>& events_str_ptr,
119 bool has_more_events); 131 bool has_more_events);
120 132
121 void OnStopTracingAcked( 133 void OnStopTracingAcked(
122 TraceMessageFilter* trace_message_filter, 134 TraceMessageFilter* trace_message_filter,
123 const std::vector<std::string>& known_category_groups); 135 const std::vector<std::string>& known_category_groups);
124 136
125 #if defined(OS_CHROMEOS) || defined(OS_WIN) 137 void OnEndAgentTracingAcked(
126 void OnEndSystemTracingAcked( 138 const std::string& agent_name,
127 const scoped_refptr<base::RefCountedString>& events_str_ptr);
128 #endif
129
130 void OnEndPowerTracingAcked(
131 const scoped_refptr<base::RefCountedString>& events_str_ptr); 139 const scoped_refptr<base::RefCountedString>& events_str_ptr);
132 140
133 void OnCaptureMonitoringSnapshotAcked( 141 void OnCaptureMonitoringSnapshotAcked(
134 TraceMessageFilter* trace_message_filter); 142 TraceMessageFilter* trace_message_filter);
135 143
136 void OnTraceLogStatusReply(TraceMessageFilter* trace_message_filter, 144 void OnTraceLogStatusReply(TraceMessageFilter* trace_message_filter,
137 const base::trace_event::TraceLogStatus& status); 145 const base::trace_event::TraceLogStatus& status);
138 void OnProcessMemoryDumpResponse(TraceMessageFilter* trace_message_filter, 146 void OnProcessMemoryDumpResponse(TraceMessageFilter* trace_message_filter,
139 uint64 dump_guid, 147 uint64 dump_guid,
140 bool success); 148 bool success);
141 149
142 // Callback of MemoryDumpManager::CreateProcessDump(). 150 // Callback of MemoryDumpManager::CreateProcessDump().
143 void OnBrowserProcessMemoryDumpDone(uint64 dump_guid, bool success); 151 void OnBrowserProcessMemoryDumpDone(uint64 dump_guid, bool success);
144 152
145 void FinalizeGlobalMemoryDumpIfAllProcessesReplied(); 153 void FinalizeGlobalMemoryDumpIfAllProcessesReplied();
146 154
147 void OnWatchEventMatched(); 155 void OnWatchEventMatched();
148 156
149 void SetEnabledOnFileThread( 157 void SetEnabledOnFileThread(
150 const base::trace_event::TraceConfig& trace_config, 158 const base::trace_event::TraceConfig& trace_config,
151 int mode, 159 int mode,
152 const base::Closure& callback); 160 const base::Closure& callback);
153 void SetDisabledOnFileThread(const base::Closure& callback); 161 void SetDisabledOnFileThread(const base::Closure& callback);
154 void OnStartTracingDone( 162 void OnStartAgentTracingDone(
155 const base::trace_event::TraceConfig& trace_config, 163 const base::trace_event::TraceConfig& trace_config,
156 const StartTracingDoneCallback& callback); 164 const StartTracingDoneCallback& callback);
157 void OnStopTracingDone(); 165 void OnStopTracingDone();
158 void OnStartMonitoringDone( 166 void OnStartMonitoringDone(
159 const base::trace_event::TraceConfig& trace_config, 167 const base::trace_event::TraceConfig& trace_config,
160 const StartMonitoringDoneCallback& callback); 168 const StartMonitoringDoneCallback& callback);
161 void OnStopMonitoringDone(const StopMonitoringDoneCallback& callback); 169 void OnStopMonitoringDone(const StopMonitoringDoneCallback& callback);
162 170
163 void OnMonitoringStateChanged(bool is_monitoring); 171 void OnMonitoringStateChanged(bool is_monitoring);
164 172
(...skipping 14 matching lines...) Expand all
179 float maximum_trace_buffer_usage_; 187 float maximum_trace_buffer_usage_;
180 size_t approximate_event_count_; 188 size_t approximate_event_count_;
181 189
182 // Pending acks for memory RequestGlobalDumpPoint. 190 // Pending acks for memory RequestGlobalDumpPoint.
183 int pending_memory_dump_ack_count_; 191 int pending_memory_dump_ack_count_;
184 int failed_memory_dump_count_; 192 int failed_memory_dump_count_;
185 TraceMessageFilterSet pending_memory_dump_filters_; 193 TraceMessageFilterSet pending_memory_dump_filters_;
186 uint64 pending_memory_dump_guid_; 194 uint64 pending_memory_dump_guid_;
187 base::trace_event::MemoryDumpCallback pending_memory_dump_callback_; 195 base::trace_event::MemoryDumpCallback pending_memory_dump_callback_;
188 196
189 #if defined(OS_CHROMEOS) || defined(OS_WIN) 197 StartTracingDoneCallback start_tracing_done_callback_;
190 bool is_system_tracing_; 198 std::vector<base::trace_event::TracingAgent*> additional_tracing_agents_;
191 #endif 199
192 bool is_tracing_; 200 bool is_tracing_;
193 bool is_monitoring_; 201 bool is_monitoring_;
194 bool is_power_tracing_;
195 202
196 GetCategoriesDoneCallback pending_get_categories_done_callback_; 203 GetCategoriesDoneCallback pending_get_categories_done_callback_;
197 GetTraceBufferUsageCallback pending_trace_buffer_usage_callback_; 204 GetTraceBufferUsageCallback pending_trace_buffer_usage_callback_;
198 205
199 std::string watch_category_name_; 206 std::string watch_category_name_;
200 std::string watch_event_name_; 207 std::string watch_event_name_;
201 WatchEventCallback watch_event_callback_; 208 WatchEventCallback watch_event_callback_;
202 209
203 base::ObserverList<TraceMessageFilterObserver> 210 base::ObserverList<TraceMessageFilterObserver>
204 trace_message_filter_observers_; 211 trace_message_filter_observers_;
205 212
206 std::set<std::string> known_category_groups_; 213 std::set<std::string> known_category_groups_;
207 std::set<TracingUI*> tracing_uis_; 214 std::set<TracingUI*> tracing_uis_;
208 scoped_refptr<TraceDataSink> trace_data_sink_; 215 scoped_refptr<TraceDataSink> trace_data_sink_;
209 scoped_refptr<TraceDataSink> monitoring_data_sink_; 216 scoped_refptr<TraceDataSink> monitoring_data_sink_;
210 217
211 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); 218 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl);
212 }; 219 };
213 220
214 } // namespace content 221 } // namespace content
215 222
216 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ 223 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698