| OLD | NEW |
| 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/callback.h" |
| 13 #include "base/files/file_path.h" |
| 12 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 13 #include "content/public/browser/tracing_controller.h" | 15 #include "content/public/browser/tracing_controller.h" |
| 14 | 16 |
| 15 namespace base { | 17 namespace base { |
| 16 class RefCountedString; | 18 class RefCountedString; |
| 17 class RefCountedMemory; | 19 class RefCountedMemory; |
| 20 |
| 21 namespace debug { |
| 22 class TraceLog; |
| 23 } |
| 18 } | 24 } |
| 19 | 25 |
| 20 namespace content { | 26 namespace content { |
| 21 | 27 |
| 22 class TraceMessageFilter; | 28 class TraceMessageFilter; |
| 23 class TracingUI; | 29 class TracingUI; |
| 24 | 30 |
| 25 class TracingControllerImpl : public TracingController { | 31 class TracingControllerImpl : public TracingController { |
| 26 public: | 32 public: |
| 33 typedef base::Callback< |
| 34 void (base::debug::TraceLog*)> DisableRecordingCallback; |
| 35 |
| 27 static TracingControllerImpl* GetInstance(); | 36 static TracingControllerImpl* GetInstance(); |
| 28 | 37 |
| 29 // TracingController implementation. | 38 // TracingController implementation. |
| 30 bool GetCategories(const GetCategoriesDoneCallback& callback) override; | 39 bool GetCategories(const GetCategoriesDoneCallback& callback) override; |
| 31 bool EnableRecording(const base::debug::CategoryFilter& category_filter, | 40 bool EnableRecording(const base::debug::CategoryFilter& category_filter, |
| 32 const base::debug::TraceOptions& trace_options, | 41 const base::debug::TraceOptions& trace_options, |
| 33 const EnableRecordingDoneCallback& callback) override; | 42 const EnableRecordingDoneCallback& callback) override; |
| 34 bool DisableRecording(const scoped_refptr<TraceDataSink>& sink) override; | 43 bool DisableRecording(const scoped_refptr<TraceDataSink>& sink) override; |
| 35 bool EnableMonitoring(const base::debug::CategoryFilter& category_filter, | 44 bool EnableMonitoring(const base::debug::CategoryFilter& category_filter, |
| 36 const base::debug::TraceOptions& trace_options, | 45 const base::debug::TraceOptions& trace_options, |
| 37 const EnableMonitoringDoneCallback& callback) override; | 46 const EnableMonitoringDoneCallback& callback) override; |
| 38 bool DisableMonitoring( | 47 bool DisableMonitoring( |
| 39 const DisableMonitoringDoneCallback& callback) override; | 48 const DisableMonitoringDoneCallback& callback) override; |
| 40 void GetMonitoringStatus( | 49 void GetMonitoringStatus( |
| 41 bool* out_enabled, | 50 bool* out_enabled, |
| 42 base::debug::CategoryFilter* out_category_filter, | 51 base::debug::CategoryFilter* out_category_filter, |
| 43 base::debug::TraceOptions* out_trace_options) override; | 52 base::debug::TraceOptions* out_trace_options) override; |
| 44 bool CaptureMonitoringSnapshot( | 53 bool CaptureMonitoringSnapshot( |
| 45 const scoped_refptr<TraceDataSink>& sink) override; | 54 const scoped_refptr<TraceDataSink>& sink) override; |
| 46 bool GetTraceBufferUsage( | 55 bool GetTraceBufferUsage( |
| 47 const GetTraceBufferUsageCallback& callback) override; | 56 const GetTraceBufferUsageCallback& callback) override; |
| 48 bool SetWatchEvent(const std::string& category_name, | 57 bool SetWatchEvent(const std::string& category_name, |
| 49 const std::string& event_name, | 58 const std::string& event_name, |
| 50 const WatchEventCallback& callback) override; | 59 const WatchEventCallback& callback) override; |
| 51 bool CancelWatchEvent() override; | 60 bool CancelWatchEvent() override; |
| 52 | 61 |
| 53 void RegisterTracingUI(TracingUI* tracing_ui); | 62 void RegisterTracingUI(TracingUI* tracing_ui); |
| 54 void UnregisterTracingUI(TracingUI* tracing_ui); | 63 void UnregisterTracingUI(TracingUI* tracing_ui); |
| 55 | 64 |
| 65 void SetDisableRecordingCallback(const DisableRecordingCallback& callback); |
| 66 |
| 56 private: | 67 private: |
| 57 typedef std::set<scoped_refptr<TraceMessageFilter> > TraceMessageFilterSet; | 68 typedef std::set<scoped_refptr<TraceMessageFilter> > TraceMessageFilterSet; |
| 58 | 69 |
| 59 friend struct base::DefaultLazyInstanceTraits<TracingControllerImpl>; | 70 friend struct base::DefaultLazyInstanceTraits<TracingControllerImpl>; |
| 60 friend class TraceMessageFilter; | 71 friend class TraceMessageFilter; |
| 61 | 72 |
| 62 TracingControllerImpl(); | 73 TracingControllerImpl(); |
| 63 ~TracingControllerImpl() override; | 74 ~TracingControllerImpl() override; |
| 64 | 75 |
| 65 bool can_enable_recording() const { | 76 bool can_enable_recording() const { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 GetTraceBufferUsageCallback pending_trace_buffer_usage_callback_; | 175 GetTraceBufferUsageCallback pending_trace_buffer_usage_callback_; |
| 165 | 176 |
| 166 std::string watch_category_name_; | 177 std::string watch_category_name_; |
| 167 std::string watch_event_name_; | 178 std::string watch_event_name_; |
| 168 WatchEventCallback watch_event_callback_; | 179 WatchEventCallback watch_event_callback_; |
| 169 | 180 |
| 170 std::set<std::string> known_category_groups_; | 181 std::set<std::string> known_category_groups_; |
| 171 std::set<TracingUI*> tracing_uis_; | 182 std::set<TracingUI*> tracing_uis_; |
| 172 scoped_refptr<TraceDataSink> trace_data_sink_; | 183 scoped_refptr<TraceDataSink> trace_data_sink_; |
| 173 scoped_refptr<TraceDataSink> monitoring_data_sink_; | 184 scoped_refptr<TraceDataSink> monitoring_data_sink_; |
| 185 DisableRecordingCallback disable_recording_callback_; |
| 186 |
| 174 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); | 187 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); |
| 175 }; | 188 }; |
| 176 | 189 |
| 177 } // namespace content | 190 } // namespace content |
| 178 | 191 |
| 179 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ | 192 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ |
| OLD | NEW |