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