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