Chromium Code Reviews| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <queue> | |
| 11 #include <set> | 12 #include <set> |
| 12 #include <string> | 13 #include <string> |
| 13 #include <vector> | 14 #include <vector> |
| 14 | 15 |
| 15 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 18 #include "base/trace_event/memory_dump_manager.h" | 19 #include "base/trace_event/memory_dump_manager.h" |
| 19 #include "base/trace_event/tracing_agent.h" | 20 #include "base/trace_event/tracing_agent.h" |
| 20 #include "content/public/browser/tracing_controller.h" | 21 #include "content/public/browser/tracing_controller.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 virtual void OnTraceMessageFilterAdded(TraceMessageFilter* filter) = 0; | 75 virtual void OnTraceMessageFilterAdded(TraceMessageFilter* filter) = 0; |
| 75 virtual void OnTraceMessageFilterRemoved(TraceMessageFilter* filter) = 0; | 76 virtual void OnTraceMessageFilterRemoved(TraceMessageFilter* filter) = 0; |
| 76 }; | 77 }; |
| 77 void AddTraceMessageFilterObserver(TraceMessageFilterObserver* observer); | 78 void AddTraceMessageFilterObserver(TraceMessageFilterObserver* observer); |
| 78 void RemoveTraceMessageFilterObserver(TraceMessageFilterObserver* observer); | 79 void RemoveTraceMessageFilterObserver(TraceMessageFilterObserver* observer); |
| 79 | 80 |
| 80 private: | 81 private: |
| 81 friend struct base::DefaultLazyInstanceTraits<TracingControllerImpl>; | 82 friend struct base::DefaultLazyInstanceTraits<TracingControllerImpl>; |
| 82 friend class TraceMessageFilter; | 83 friend class TraceMessageFilter; |
| 83 | 84 |
| 85 // The arguments and callback for an enqueued global memory dump request. | |
| 86 struct GlobalMemoryDumpRequest { | |
|
Primiano Tucci (use gerrit)
2016/06/16 08:37:23
I'd call this QueuedMemoryDumpRequest, at first I
petrcermak
2016/06/16 12:08:33
Done.
| |
| 87 GlobalMemoryDumpRequest( | |
| 88 const base::trace_event::MemoryDumpRequestArgs& args, | |
| 89 const base::trace_event::MemoryDumpCallback& callback); | |
| 90 ~GlobalMemoryDumpRequest(); | |
| 91 const base::trace_event::MemoryDumpRequestArgs args; | |
| 92 const base::trace_event::MemoryDumpCallback callback; | |
| 93 }; | |
| 94 | |
| 84 TracingControllerImpl(); | 95 TracingControllerImpl(); |
| 85 ~TracingControllerImpl() override; | 96 ~TracingControllerImpl() override; |
| 86 | 97 |
| 87 bool can_start_tracing() const { | 98 bool can_start_tracing() const { |
| 88 return !is_tracing_; | 99 return !is_tracing_; |
| 89 } | 100 } |
| 90 | 101 |
| 91 bool can_stop_tracing() const { | 102 bool can_stop_tracing() const { |
| 92 return is_tracing_ && !trace_data_sink_.get(); | 103 return is_tracing_ && !trace_data_sink_.get(); |
| 93 } | 104 } |
| 94 | 105 |
| 95 bool can_start_monitoring() const { | 106 bool can_start_monitoring() const { |
| 96 return !is_monitoring_; | 107 return !is_monitoring_; |
| 97 } | 108 } |
| 98 | 109 |
| 99 bool can_stop_monitoring() const { | 110 bool can_stop_monitoring() const { |
| 100 return is_monitoring_ && !monitoring_data_sink_.get(); | 111 return is_monitoring_ && !monitoring_data_sink_.get(); |
| 101 } | 112 } |
| 102 | 113 |
| 103 bool can_get_trace_buffer_usage() const { | 114 bool can_get_trace_buffer_usage() const { |
| 104 return pending_trace_buffer_usage_callback_.is_null(); | 115 return pending_trace_buffer_usage_callback_.is_null(); |
| 105 } | 116 } |
| 106 | 117 |
| 107 bool can_cancel_watch_event() const { | 118 bool can_cancel_watch_event() const { |
| 108 return !watch_event_callback_.is_null(); | 119 return !watch_event_callback_.is_null(); |
| 109 } | 120 } |
| 110 | 121 |
| 122 void PerformGlobalMemoryDump( | |
| 123 const base::trace_event::MemoryDumpRequestArgs& args, | |
| 124 const base::trace_event::MemoryDumpCallback& callback); | |
| 125 | |
| 111 // Methods for use by TraceMessageFilter. | 126 // Methods for use by TraceMessageFilter. |
| 112 void AddTraceMessageFilter(TraceMessageFilter* trace_message_filter); | 127 void AddTraceMessageFilter(TraceMessageFilter* trace_message_filter); |
| 113 void RemoveTraceMessageFilter(TraceMessageFilter* trace_message_filter); | 128 void RemoveTraceMessageFilter(TraceMessageFilter* trace_message_filter); |
| 114 | 129 |
| 115 void OnTraceDataCollected( | 130 void OnTraceDataCollected( |
| 116 const scoped_refptr<base::RefCountedString>& events_str_ptr); | 131 const scoped_refptr<base::RefCountedString>& events_str_ptr); |
| 117 | 132 |
| 118 // Callback of TraceLog::Flush() for the local trace. | 133 // Callback of TraceLog::Flush() for the local trace. |
| 119 void OnLocalTraceDataCollected( | 134 void OnLocalTraceDataCollected( |
| 120 const scoped_refptr<base::RefCountedString>& events_str_ptr, | 135 const scoped_refptr<base::RefCountedString>& events_str_ptr, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 // Pending acks for GetTraceLogStatus. | 195 // Pending acks for GetTraceLogStatus. |
| 181 int pending_trace_log_status_ack_count_; | 196 int pending_trace_log_status_ack_count_; |
| 182 TraceMessageFilterSet pending_trace_log_status_filters_; | 197 TraceMessageFilterSet pending_trace_log_status_filters_; |
| 183 float maximum_trace_buffer_usage_; | 198 float maximum_trace_buffer_usage_; |
| 184 size_t approximate_event_count_; | 199 size_t approximate_event_count_; |
| 185 | 200 |
| 186 // Pending acks for memory RequestGlobalDumpPoint. | 201 // Pending acks for memory RequestGlobalDumpPoint. |
| 187 int pending_memory_dump_ack_count_; | 202 int pending_memory_dump_ack_count_; |
| 188 int failed_memory_dump_count_; | 203 int failed_memory_dump_count_; |
| 189 TraceMessageFilterSet pending_memory_dump_filters_; | 204 TraceMessageFilterSet pending_memory_dump_filters_; |
| 190 uint64_t pending_memory_dump_guid_; | 205 uint64_t pending_memory_dump_guid_; |
|
Primiano Tucci (use gerrit)
2016/06/16 08:37:23
I think at this point you can get rid of pending_g
petrcermak
2016/06/16 12:08:32
Done.
| |
| 191 base::trace_event::MemoryDumpCallback pending_memory_dump_callback_; | 206 base::trace_event::MemoryDumpCallback pending_memory_dump_callback_; |
| 207 std::queue<GlobalMemoryDumpRequest> enqueued_memory_dump_requests_; | |
|
Primiano Tucci (use gerrit)
2016/06/16 08:37:23
I'd drop the "en". I'm not a native speaker but "e
petrcermak
2016/06/16 12:08:32
Done, but "enqueued" sounded more posh :-P
| |
| 192 | 208 |
| 193 std::vector<base::trace_event::TracingAgent*> additional_tracing_agents_; | 209 std::vector<base::trace_event::TracingAgent*> additional_tracing_agents_; |
| 194 int pending_clock_sync_ack_count_; | 210 int pending_clock_sync_ack_count_; |
| 195 base::OneShotTimer clock_sync_timer_; | 211 base::OneShotTimer clock_sync_timer_; |
| 196 | 212 |
| 197 bool is_tracing_; | 213 bool is_tracing_; |
| 198 bool is_monitoring_; | 214 bool is_monitoring_; |
| 199 | 215 |
| 200 GetCategoriesDoneCallback pending_get_categories_done_callback_; | 216 GetCategoriesDoneCallback pending_get_categories_done_callback_; |
| 201 GetTraceBufferUsageCallback pending_trace_buffer_usage_callback_; | 217 GetTraceBufferUsageCallback pending_trace_buffer_usage_callback_; |
| 202 | 218 |
| 203 std::string watch_category_name_; | 219 std::string watch_category_name_; |
| 204 std::string watch_event_name_; | 220 std::string watch_event_name_; |
| 205 WatchEventCallback watch_event_callback_; | 221 WatchEventCallback watch_event_callback_; |
| 206 | 222 |
| 207 base::ObserverList<TraceMessageFilterObserver> | 223 base::ObserverList<TraceMessageFilterObserver> |
| 208 trace_message_filter_observers_; | 224 trace_message_filter_observers_; |
| 209 | 225 |
| 210 std::set<std::string> known_category_groups_; | 226 std::set<std::string> known_category_groups_; |
| 211 std::set<TracingUI*> tracing_uis_; | 227 std::set<TracingUI*> tracing_uis_; |
| 212 scoped_refptr<TraceDataSink> trace_data_sink_; | 228 scoped_refptr<TraceDataSink> trace_data_sink_; |
| 213 scoped_refptr<TraceDataSink> monitoring_data_sink_; | 229 scoped_refptr<TraceDataSink> monitoring_data_sink_; |
| 214 | 230 |
| 215 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); | 231 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); |
| 216 }; | 232 }; |
| 217 | 233 |
| 218 } // namespace content | 234 } // namespace content |
| 219 | 235 |
| 220 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ | 236 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ |
| OLD | NEW |