| 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 "base/trace_event/memory_dump_manager.h" |
| 13 #include "content/public/browser/tracing_controller.h" | 14 #include "content/public/browser/tracing_controller.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class RefCountedString; | 17 class RefCountedString; |
| 17 class RefCountedMemory; | 18 class RefCountedMemory; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 | 22 |
| 22 class TraceMessageFilter; | 23 class TraceMessageFilter; |
| 23 class TracingUI; | 24 class TracingUI; |
| 24 | 25 |
| 25 class TracingControllerImpl : public TracingController { | 26 class TracingControllerImpl |
| 27 : public TracingController, |
| 28 public base::trace_event::MemoryDumpManagerDelegate { |
| 26 public: | 29 public: |
| 27 static TracingControllerImpl* GetInstance(); | 30 static TracingControllerImpl* GetInstance(); |
| 28 | 31 |
| 29 // TracingController implementation. | 32 // TracingController implementation. |
| 30 bool GetCategories(const GetCategoriesDoneCallback& callback) override; | 33 bool GetCategories(const GetCategoriesDoneCallback& callback) override; |
| 31 bool EnableRecording(const base::trace_event::CategoryFilter& category_filter, | 34 bool EnableRecording(const base::trace_event::CategoryFilter& category_filter, |
| 32 const base::trace_event::TraceOptions& trace_options, | 35 const base::trace_event::TraceOptions& trace_options, |
| 33 const EnableRecordingDoneCallback& callback) override; | 36 const EnableRecordingDoneCallback& callback) override; |
| 34 bool DisableRecording(const scoped_refptr<TraceDataSink>& sink) override; | 37 bool DisableRecording(const scoped_refptr<TraceDataSink>& sink) override; |
| 35 bool EnableMonitoring( | 38 bool EnableMonitoring( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 47 bool GetTraceBufferUsage( | 50 bool GetTraceBufferUsage( |
| 48 const GetTraceBufferUsageCallback& callback) override; | 51 const GetTraceBufferUsageCallback& callback) override; |
| 49 bool SetWatchEvent(const std::string& category_name, | 52 bool SetWatchEvent(const std::string& category_name, |
| 50 const std::string& event_name, | 53 const std::string& event_name, |
| 51 const WatchEventCallback& callback) override; | 54 const WatchEventCallback& callback) override; |
| 52 bool CancelWatchEvent() override; | 55 bool CancelWatchEvent() override; |
| 53 | 56 |
| 54 void RegisterTracingUI(TracingUI* tracing_ui); | 57 void RegisterTracingUI(TracingUI* tracing_ui); |
| 55 void UnregisterTracingUI(TracingUI* tracing_ui); | 58 void UnregisterTracingUI(TracingUI* tracing_ui); |
| 56 | 59 |
| 60 // base::trace_event::MemoryDumpManagerDelegate implementation. |
| 61 void RequestGlobalMemoryDump( |
| 62 const base::trace_event::MemoryDumpRequestArgs& args, |
| 63 const base::trace_event::MemoryDumpCallback& callback) override; |
| 64 |
| 57 private: | 65 private: |
| 58 typedef std::set<scoped_refptr<TraceMessageFilter> > TraceMessageFilterSet; | 66 typedef std::set<scoped_refptr<TraceMessageFilter> > TraceMessageFilterSet; |
| 59 | 67 |
| 60 friend struct base::DefaultLazyInstanceTraits<TracingControllerImpl>; | 68 friend struct base::DefaultLazyInstanceTraits<TracingControllerImpl>; |
| 61 friend class TraceMessageFilter; | 69 friend class TraceMessageFilter; |
| 62 | 70 |
| 63 TracingControllerImpl(); | 71 TracingControllerImpl(); |
| 64 ~TracingControllerImpl() override; | 72 ~TracingControllerImpl() override; |
| 65 | 73 |
| 66 bool can_enable_recording() const { | 74 bool can_enable_recording() const { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 #if defined(OS_CHROMEOS) || defined(OS_WIN) | 120 #if defined(OS_CHROMEOS) || defined(OS_WIN) |
| 113 void OnEndSystemTracingAcked( | 121 void OnEndSystemTracingAcked( |
| 114 const scoped_refptr<base::RefCountedString>& events_str_ptr); | 122 const scoped_refptr<base::RefCountedString>& events_str_ptr); |
| 115 #endif | 123 #endif |
| 116 | 124 |
| 117 void OnCaptureMonitoringSnapshotAcked( | 125 void OnCaptureMonitoringSnapshotAcked( |
| 118 TraceMessageFilter* trace_message_filter); | 126 TraceMessageFilter* trace_message_filter); |
| 119 | 127 |
| 120 void OnTraceLogStatusReply(TraceMessageFilter* trace_message_filter, | 128 void OnTraceLogStatusReply(TraceMessageFilter* trace_message_filter, |
| 121 const base::trace_event::TraceLogStatus& status); | 129 const base::trace_event::TraceLogStatus& status); |
| 122 | 130 void OnProcessMemoryDumpResponse(TraceMessageFilter* trace_message_filter, |
| 131 uint64 dump_guid, |
| 132 bool success); |
| 123 void OnWatchEventMatched(); | 133 void OnWatchEventMatched(); |
| 124 | 134 |
| 125 void SetEnabledOnFileThread( | 135 void SetEnabledOnFileThread( |
| 126 const base::trace_event::CategoryFilter& category_filter, | 136 const base::trace_event::CategoryFilter& category_filter, |
| 127 int mode, | 137 int mode, |
| 128 const base::trace_event::TraceOptions& trace_options, | 138 const base::trace_event::TraceOptions& trace_options, |
| 129 const base::Closure& callback); | 139 const base::Closure& callback); |
| 130 void SetDisabledOnFileThread(const base::Closure& callback); | 140 void SetDisabledOnFileThread(const base::Closure& callback); |
| 131 void OnEnableRecordingDone( | 141 void OnEnableRecordingDone( |
| 132 const base::trace_event::CategoryFilter& category_filter, | 142 const base::trace_event::CategoryFilter& category_filter, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 std::set<std::string> known_category_groups_; | 182 std::set<std::string> known_category_groups_; |
| 173 std::set<TracingUI*> tracing_uis_; | 183 std::set<TracingUI*> tracing_uis_; |
| 174 scoped_refptr<TraceDataSink> trace_data_sink_; | 184 scoped_refptr<TraceDataSink> trace_data_sink_; |
| 175 scoped_refptr<TraceDataSink> monitoring_data_sink_; | 185 scoped_refptr<TraceDataSink> monitoring_data_sink_; |
| 176 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); | 186 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); |
| 177 }; | 187 }; |
| 178 | 188 |
| 179 } // namespace content | 189 } // namespace content |
| 180 | 190 |
| 181 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ | 191 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ |
| OLD | NEW |