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

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: Created 5 years, 1 month 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 156
145 void FinalizeGlobalMemoryDumpIfAllProcessesReplied(); 157 void FinalizeGlobalMemoryDumpIfAllProcessesReplied();
146 158
147 void OnWatchEventMatched(); 159 void OnWatchEventMatched();
148 160
149 void SetEnabledOnFileThread( 161 void SetEnabledOnFileThread(
150 const base::trace_event::TraceConfig& trace_config, 162 const base::trace_event::TraceConfig& trace_config,
151 int mode, 163 int mode,
152 const base::Closure& callback); 164 const base::Closure& callback);
153 void SetDisabledOnFileThread(const base::Closure& callback); 165 void SetDisabledOnFileThread(const base::Closure& callback);
154 void OnStartTracingDone( 166 void OnStartAgentTracingDone(
155 const base::trace_event::TraceConfig& trace_config, 167 const base::trace_event::TraceConfig& trace_config,
156 const StartTracingDoneCallback& callback); 168 const StartTracingDoneCallback& callback);
157 void OnStopTracingDone(); 169 void OnStopTracingDone();
158 void OnStartMonitoringDone( 170 void OnStartMonitoringDone(
159 const base::trace_event::TraceConfig& trace_config, 171 const base::trace_event::TraceConfig& trace_config,
160 const StartMonitoringDoneCallback& callback); 172 const StartMonitoringDoneCallback& callback);
161 void OnStopMonitoringDone(const StopMonitoringDoneCallback& callback); 173 void OnStopMonitoringDone(const StopMonitoringDoneCallback& callback);
162 174
163 void OnMonitoringStateChanged(bool is_monitoring); 175 void OnMonitoringStateChanged(bool is_monitoring);
164 176
(...skipping 14 matching lines...) Expand all
179 float maximum_trace_buffer_usage_; 191 float maximum_trace_buffer_usage_;
180 size_t approximate_event_count_; 192 size_t approximate_event_count_;
181 193
182 // Pending acks for memory RequestGlobalDumpPoint. 194 // Pending acks for memory RequestGlobalDumpPoint.
183 int pending_memory_dump_ack_count_; 195 int pending_memory_dump_ack_count_;
184 int failed_memory_dump_count_; 196 int failed_memory_dump_count_;
185 TraceMessageFilterSet pending_memory_dump_filters_; 197 TraceMessageFilterSet pending_memory_dump_filters_;
186 uint64 pending_memory_dump_guid_; 198 uint64 pending_memory_dump_guid_;
187 base::trace_event::MemoryDumpCallback pending_memory_dump_callback_; 199 base::trace_event::MemoryDumpCallback pending_memory_dump_callback_;
188 200
201 StartTracingDoneCallback start_tracing_done_callback_;
189 #if defined(OS_CHROMEOS) || defined(OS_WIN) 202 #if defined(OS_CHROMEOS) || defined(OS_WIN)
190 bool is_system_tracing_; 203 bool is_system_tracing_;
191 #endif 204 #endif
192 bool is_tracing_; 205 bool is_tracing_;
193 bool is_monitoring_; 206 bool is_monitoring_;
194 bool is_power_tracing_; 207 bool is_power_tracing_;
195 208
196 GetCategoriesDoneCallback pending_get_categories_done_callback_; 209 GetCategoriesDoneCallback pending_get_categories_done_callback_;
197 GetTraceBufferUsageCallback pending_trace_buffer_usage_callback_; 210 GetTraceBufferUsageCallback pending_trace_buffer_usage_callback_;
198 211
199 std::string watch_category_name_; 212 std::string watch_category_name_;
200 std::string watch_event_name_; 213 std::string watch_event_name_;
201 WatchEventCallback watch_event_callback_; 214 WatchEventCallback watch_event_callback_;
202 215
203 base::ObserverList<TraceMessageFilterObserver> 216 base::ObserverList<TraceMessageFilterObserver>
204 trace_message_filter_observers_; 217 trace_message_filter_observers_;
205 218
206 std::set<std::string> known_category_groups_; 219 std::set<std::string> known_category_groups_;
207 std::set<TracingUI*> tracing_uis_; 220 std::set<TracingUI*> tracing_uis_;
208 scoped_refptr<TraceDataSink> trace_data_sink_; 221 scoped_refptr<TraceDataSink> trace_data_sink_;
209 scoped_refptr<TraceDataSink> monitoring_data_sink_; 222 scoped_refptr<TraceDataSink> monitoring_data_sink_;
210 223
211 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); 224 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl);
212 }; 225 };
213 226
214 } // namespace content 227 } // namespace content
215 228
216 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ 229 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698