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 #include "content/browser/tracing/tracing_controller_impl.h" | 4 #include "content/browser/tracing/tracing_controller_impl.h" |
5 | 5 |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/cpu.h" | 7 #include "base/cpu.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 using base::trace_event::TraceLog; | 38 using base::trace_event::TraceLog; |
39 using base::trace_event::TraceConfig; | 39 using base::trace_event::TraceConfig; |
40 | 40 |
41 namespace content { | 41 namespace content { |
42 | 42 |
43 namespace { | 43 namespace { |
44 | 44 |
45 base::LazyInstance<TracingControllerImpl>::Leaky g_controller = | 45 base::LazyInstance<TracingControllerImpl>::Leaky g_controller = |
46 LAZY_INSTANCE_INITIALIZER; | 46 LAZY_INSTANCE_INITIALIZER; |
47 | 47 |
48 | |
49 std::string GetNetworkTypeString() { | 48 std::string GetNetworkTypeString() { |
50 switch (net::NetworkChangeNotifier::GetConnectionType()) { | 49 switch (net::NetworkChangeNotifier::GetConnectionType()) { |
51 case net::NetworkChangeNotifier::CONNECTION_ETHERNET: | 50 case net::NetworkChangeNotifier::CONNECTION_ETHERNET: |
52 return "Ethernet"; | 51 return "Ethernet"; |
53 case net::NetworkChangeNotifier::CONNECTION_WIFI: | 52 case net::NetworkChangeNotifier::CONNECTION_WIFI: |
54 return "WiFi"; | 53 return "WiFi"; |
55 case net::NetworkChangeNotifier::CONNECTION_2G: | 54 case net::NetworkChangeNotifier::CONNECTION_2G: |
56 return "2G"; | 55 return "2G"; |
57 case net::NetworkChangeNotifier::CONNECTION_3G: | 56 case net::NetworkChangeNotifier::CONNECTION_3G: |
58 return "3G"; | 57 return "3G"; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 } | 137 } |
139 | 138 |
140 TracingControllerImpl::TracingControllerImpl() | 139 TracingControllerImpl::TracingControllerImpl() |
141 : pending_stop_tracing_ack_count_(0), | 140 : pending_stop_tracing_ack_count_(0), |
142 pending_capture_monitoring_snapshot_ack_count_(0), | 141 pending_capture_monitoring_snapshot_ack_count_(0), |
143 pending_trace_log_status_ack_count_(0), | 142 pending_trace_log_status_ack_count_(0), |
144 maximum_trace_buffer_usage_(0), | 143 maximum_trace_buffer_usage_(0), |
145 approximate_event_count_(0), | 144 approximate_event_count_(0), |
146 pending_memory_dump_ack_count_(0), | 145 pending_memory_dump_ack_count_(0), |
147 failed_memory_dump_count_(0), | 146 failed_memory_dump_count_(0), |
148 // Tracing may have been enabled by ContentMainRunner if kTraceStartup | 147 start_tracing_done_callback_(StartTracingDoneCallback()), |
149 // is specified in command line. | 148 additional_tracing_agents_( |
shatch
2015/11/27 19:29:18
nit: Don't think you need these
Zhen Wang
2015/12/01 00:14:32
Done.
| |
150 #if defined(OS_CHROMEOS) || defined(OS_WIN) | 149 std::vector<base::trace_event::TracingAgent*>()), |
151 is_system_tracing_(false), | |
152 #endif | |
153 is_tracing_(false), | 150 is_tracing_(false), |
154 is_monitoring_(false), | 151 is_monitoring_(false) { |
155 is_power_tracing_(false) { | |
156 base::trace_event::MemoryDumpManager::GetInstance()->Initialize( | 152 base::trace_event::MemoryDumpManager::GetInstance()->Initialize( |
157 this /* delegate */, true /* is_coordinator */); | 153 this /* delegate */, true /* is_coordinator */); |
158 | 154 |
159 // Deliberately leaked, like this class. | 155 // Deliberately leaked, like this class. |
160 base::FileTracing::SetProvider(new FileTracingProviderImpl); | 156 base::FileTracing::SetProvider(new FileTracingProviderImpl); |
161 } | 157 } |
162 | 158 |
163 TracingControllerImpl::~TracingControllerImpl() { | 159 TracingControllerImpl::~TracingControllerImpl() { |
164 // This is a Leaky instance. | 160 // This is a Leaky instance. |
165 NOTREACHED(); | 161 NOTREACHED(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 199 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
204 | 200 |
205 TraceLog::GetInstance()->SetDisabled(); | 201 TraceLog::GetInstance()->SetDisabled(); |
206 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); | 202 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); |
207 } | 203 } |
208 | 204 |
209 bool TracingControllerImpl::StartTracing( | 205 bool TracingControllerImpl::StartTracing( |
210 const TraceConfig& trace_config, | 206 const TraceConfig& trace_config, |
211 const StartTracingDoneCallback& callback) { | 207 const StartTracingDoneCallback& callback) { |
212 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 208 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
209 DCHECK(additional_tracing_agents_.empty()); | |
213 | 210 |
214 if (!can_start_tracing()) | 211 if (!can_start_tracing()) |
215 return false; | 212 return false; |
216 is_tracing_ = true; | 213 is_tracing_ = true; |
214 start_tracing_done_callback_ = callback; | |
217 | 215 |
218 #if defined(OS_ANDROID) | 216 #if defined(OS_ANDROID) |
219 if (pending_get_categories_done_callback_.is_null()) | 217 if (pending_get_categories_done_callback_.is_null()) |
220 TraceLog::GetInstance()->AddClockSyncMetadataEvent(); | 218 TraceLog::GetInstance()->AddClockSyncMetadataEvent(); |
221 #endif | 219 #endif |
222 | 220 |
223 if (trace_config.IsSystraceEnabled()) { | 221 if (trace_config.IsSystraceEnabled()) { |
224 DCHECK(!is_power_tracing_); | 222 if (PowerTracingAgent::GetInstance()->StartAgentTracing(trace_config)) |
225 is_power_tracing_ = PowerTracingAgent::GetInstance()->StartTracing(); | 223 additional_tracing_agents_.push_back(PowerTracingAgent::GetInstance()); |
226 #if defined(OS_CHROMEOS) | 224 #if defined(OS_CHROMEOS) |
227 DCHECK(!is_system_tracing_); | 225 if (chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()-> |
228 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()-> | 226 StartAgentTracing(trace_config)) { |
229 StartSystemTracing(); | 227 additional_tracing_agents_.push_back( |
230 is_system_tracing_ = true; | 228 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()); |
229 } | |
231 #elif defined(OS_WIN) | 230 #elif defined(OS_WIN) |
232 DCHECK(!is_system_tracing_); | 231 if (EtwSystemEventConsumer::GetInstance()->StartAgentTracing( |
233 is_system_tracing_ = | 232 trace_config)) { |
234 EtwSystemEventConsumer::GetInstance()->StartSystemTracing(); | 233 additional_tracing_agents_.push_back( |
234 EtwSystemEventConsumer::GetInstance()); | |
235 } | |
235 #endif | 236 #endif |
236 } | 237 } |
237 | 238 |
238 // TraceLog may have been enabled in startup tracing before threads are ready. | 239 // TraceLog may have been enabled in startup tracing before threads are ready. |
239 if (TraceLog::GetInstance()->IsEnabled()) | 240 if (TraceLog::GetInstance()->IsEnabled()) |
240 return true; | 241 return true; |
241 | 242 return StartAgentTracing(trace_config); |
242 base::Closure on_start_tracing_done_callback = | |
243 base::Bind(&TracingControllerImpl::OnStartTracingDone, | |
244 base::Unretained(this), | |
245 trace_config, callback); | |
246 if (!BrowserThread::PostTask( | |
247 BrowserThread::FILE, FROM_HERE, | |
248 base::Bind(&TracingControllerImpl::SetEnabledOnFileThread, | |
249 base::Unretained(this), trace_config, | |
250 base::trace_event::TraceLog::RECORDING_MODE, | |
251 on_start_tracing_done_callback))) { | |
252 // BrowserThread::PostTask fails if the threads haven't been created yet, | |
253 // so it should be safe to just use TraceLog::SetEnabled directly. | |
254 base::trace_event::TraceLog::GetInstance()->SetEnabled( | |
255 trace_config, base::trace_event::TraceLog::RECORDING_MODE); | |
256 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | |
257 on_start_tracing_done_callback); | |
258 } | |
259 | |
260 return true; | |
261 } | 243 } |
262 | 244 |
263 void TracingControllerImpl::OnStartTracingDone( | 245 void TracingControllerImpl::OnStartAgentTracingDone( |
264 const TraceConfig& trace_config, | 246 const TraceConfig& trace_config, |
265 const StartTracingDoneCallback& callback) { | 247 const StartTracingDoneCallback& callback) { |
266 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 248 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
267 | 249 |
268 TRACE_EVENT_API_ADD_METADATA_EVENT("IsTimeTicksHighResolution", "value", | 250 TRACE_EVENT_API_ADD_METADATA_EVENT("IsTimeTicksHighResolution", "value", |
269 base::TimeTicks::IsHighResolution()); | 251 base::TimeTicks::IsHighResolution()); |
270 TRACE_EVENT_API_ADD_METADATA_EVENT("TraceConfig", "value", | 252 TRACE_EVENT_API_ADD_METADATA_EVENT("TraceConfig", "value", |
271 trace_config.AsConvertableToTraceFormat()); | 253 trace_config.AsConvertableToTraceFormat()); |
272 | 254 |
273 // Notify all child processes. | 255 // Notify all child processes. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 #if defined(OS_ANDROID) | 290 #if defined(OS_ANDROID) |
309 if (pending_get_categories_done_callback_.is_null()) | 291 if (pending_get_categories_done_callback_.is_null()) |
310 TraceLog::GetInstance()->AddClockSyncMetadataEvent(); | 292 TraceLog::GetInstance()->AddClockSyncMetadataEvent(); |
311 #endif | 293 #endif |
312 | 294 |
313 // Count myself (local trace) in pending_stop_tracing_ack_count_, | 295 // Count myself (local trace) in pending_stop_tracing_ack_count_, |
314 // acked below. | 296 // acked below. |
315 pending_stop_tracing_ack_count_ = trace_message_filters_.size() + 1; | 297 pending_stop_tracing_ack_count_ = trace_message_filters_.size() + 1; |
316 pending_stop_tracing_filters_ = trace_message_filters_; | 298 pending_stop_tracing_filters_ = trace_message_filters_; |
317 | 299 |
318 #if defined(OS_CHROMEOS) || defined(OS_WIN) | 300 pending_stop_tracing_ack_count_ += additional_tracing_agents_.size(); |
319 if (is_system_tracing_) { | 301 std::vector<base::trace_event::TracingAgent*>::iterator it; |
320 // Disable system tracing. | 302 for (it = additional_tracing_agents_.begin(); |
shatch
2015/11/27 19:29:18
for (auto it : additional_tracing_agents) ?
Zhen Wang
2015/12/01 00:14:32
Done.
| |
321 is_system_tracing_ = false; | 303 it != additional_tracing_agents_.end(); ++it) { |
322 ++pending_stop_tracing_ack_count_; | |
323 | |
324 #if defined(OS_CHROMEOS) | 304 #if defined(OS_CHROMEOS) |
325 scoped_refptr<base::TaskRunner> task_runner = | 305 if ((*it)->GetTracingAgentName() == kCrOSTracingAgentName) { |
326 BrowserThread::GetBlockingPool(); | 306 scoped_refptr<base::TaskRunner> task_runner = |
327 chromeos::DBusThreadManager::Get() | 307 BrowserThread::GetBlockingPool(); |
328 ->GetDebugDaemonClient() | 308 static_cast<chromeos::DebugDaemonClient*>( |
329 ->RequestStopSystemTracing( | 309 *it)->SetStopAgentTracingTaskRunner(task_runner); |
330 task_runner, | 310 } |
331 base::Bind(&TracingControllerImpl::OnEndSystemTracingAcked, | |
332 base::Unretained(this))); | |
333 #elif defined(OS_WIN) | |
334 EtwSystemEventConsumer::GetInstance()->StopSystemTracing( | |
335 base::Bind(&TracingControllerImpl::OnEndSystemTracingAcked, | |
336 base::Unretained(this))); | |
337 #endif | 311 #endif |
338 } | 312 (*it)->StopAgentTracing( |
339 #endif // defined(OS_CHROMEOS) || defined(OS_WIN) | 313 base::Bind(&TracingControllerImpl::OnEndAgentTracingAcked, |
340 | |
341 if (is_power_tracing_) { | |
342 is_power_tracing_ = false; | |
343 ++pending_stop_tracing_ack_count_; | |
344 PowerTracingAgent::GetInstance()->StopTracing( | |
345 base::Bind(&TracingControllerImpl::OnEndPowerTracingAcked, | |
346 base::Unretained(this))); | 314 base::Unretained(this))); |
347 } | 315 } |
316 additional_tracing_agents_.clear(); | |
348 | 317 |
349 // Handle special case of zero child processes by immediately flushing the | 318 StopAgentTracing(StopAgentTracingCallback()); |
350 // trace log. Once the flush has completed the caller will be notified that | |
351 // tracing has ended. | |
352 if (pending_stop_tracing_ack_count_ == 1) { | |
353 // Flush/cancel asynchronously now, because we don't have any children to | |
354 // wait for. | |
355 if (trace_data_sink_) { | |
356 TraceLog::GetInstance()->Flush( | |
357 base::Bind(&TracingControllerImpl::OnLocalTraceDataCollected, | |
358 base::Unretained(this)), | |
359 true); | |
360 } else { | |
361 TraceLog::GetInstance()->CancelTracing( | |
362 base::Bind(&TracingControllerImpl::OnLocalTraceDataCollected, | |
363 base::Unretained(this))); | |
364 } | |
365 } | |
366 | |
367 // Notify all child processes. | |
368 for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); | |
369 it != trace_message_filters_.end(); ++it) { | |
370 if (trace_data_sink_) | |
371 it->get()->SendEndTracing(); | |
372 else | |
373 it->get()->SendCancelTracing(); | |
374 } | |
375 } | 319 } |
376 | 320 |
377 bool TracingControllerImpl::StartMonitoring( | 321 bool TracingControllerImpl::StartMonitoring( |
378 const TraceConfig& trace_config, | 322 const TraceConfig& trace_config, |
379 const StartMonitoringDoneCallback& callback) { | 323 const StartMonitoringDoneCallback& callback) { |
380 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 324 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
381 | 325 |
382 if (!can_start_monitoring()) | 326 if (!can_start_monitoring()) |
383 return false; | 327 return false; |
384 OnMonitoringStateChanged(true); | 328 OnMonitoringStateChanged(true); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
721 // Trigger callback if one is set. | 665 // Trigger callback if one is set. |
722 if (!pending_get_categories_done_callback_.is_null()) { | 666 if (!pending_get_categories_done_callback_.is_null()) { |
723 pending_get_categories_done_callback_.Run(known_category_groups_); | 667 pending_get_categories_done_callback_.Run(known_category_groups_); |
724 pending_get_categories_done_callback_.Reset(); | 668 pending_get_categories_done_callback_.Reset(); |
725 } else if (trace_data_sink_.get()) { | 669 } else if (trace_data_sink_.get()) { |
726 trace_data_sink_->Close(); | 670 trace_data_sink_->Close(); |
727 trace_data_sink_ = NULL; | 671 trace_data_sink_ = NULL; |
728 } | 672 } |
729 } | 673 } |
730 | 674 |
731 void TracingControllerImpl::OnEndPowerTracingAcked( | 675 void TracingControllerImpl::OnEndAgentTracingAcked( |
676 const std::string& agent_name, | |
732 const scoped_refptr<base::RefCountedString>& events_str_ptr) { | 677 const scoped_refptr<base::RefCountedString>& events_str_ptr) { |
733 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 678 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
734 | 679 |
735 if (trace_data_sink_.get()) { | 680 if (trace_data_sink_.get()) { |
736 std::string json_string = base::GetQuotedJSONString(events_str_ptr->data()); | 681 std::string json_string; |
737 trace_data_sink_->SetPowerTrace(json_string); | 682 if (agent_name == kETWTracingAgentName) { |
683 // The Windows kernel events are kept into a JSON format stored as string | |
684 // and must not be escaped. | |
685 json_string = events_str_ptr->data(); | |
686 } else { | |
687 json_string = base::GetQuotedJSONString(events_str_ptr->data()); | |
688 } | |
689 trace_data_sink_->AddAdditionalTracingAgentTrace(agent_name, json_string); | |
738 } | 690 } |
739 std::vector<std::string> category_groups; | 691 std::vector<std::string> category_groups; |
740 OnStopTracingAcked(NULL, category_groups); | 692 OnStopTracingAcked(NULL, category_groups); |
741 } | 693 } |
742 | 694 |
743 #if defined(OS_CHROMEOS) || defined(OS_WIN) | |
744 void TracingControllerImpl::OnEndSystemTracingAcked( | |
745 const scoped_refptr<base::RefCountedString>& events_str_ptr) { | |
746 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
747 | |
748 if (trace_data_sink_.get()) { | |
749 #if defined(OS_WIN) | |
750 // The Windows kernel events are kept into a JSon format stored as string | |
751 // and must not be escaped. | |
752 std::string json_string = events_str_ptr->data(); | |
753 #else | |
754 std::string json_string = | |
755 base::GetQuotedJSONString(events_str_ptr->data()); | |
756 #endif | |
757 trace_data_sink_->SetSystemTrace(json_string); | |
758 } | |
759 DCHECK(!is_system_tracing_); | |
760 std::vector<std::string> category_groups; | |
761 OnStopTracingAcked(NULL, category_groups); | |
762 } | |
763 #endif | |
764 | |
765 void TracingControllerImpl::OnCaptureMonitoringSnapshotAcked( | 695 void TracingControllerImpl::OnCaptureMonitoringSnapshotAcked( |
766 TraceMessageFilter* trace_message_filter) { | 696 TraceMessageFilter* trace_message_filter) { |
767 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 697 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
768 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 698 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
769 base::Bind(&TracingControllerImpl::OnCaptureMonitoringSnapshotAcked, | 699 base::Bind(&TracingControllerImpl::OnCaptureMonitoringSnapshotAcked, |
770 base::Unretained(this), | 700 base::Unretained(this), |
771 make_scoped_refptr(trace_message_filter))); | 701 make_scoped_refptr(trace_message_filter))); |
772 return; | 702 return; |
773 } | 703 } |
774 | 704 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
907 DCHECK(tracing_uis_.find(tracing_ui) == tracing_uis_.end()); | 837 DCHECK(tracing_uis_.find(tracing_ui) == tracing_uis_.end()); |
908 tracing_uis_.insert(tracing_ui); | 838 tracing_uis_.insert(tracing_ui); |
909 } | 839 } |
910 | 840 |
911 void TracingControllerImpl::UnregisterTracingUI(TracingUI* tracing_ui) { | 841 void TracingControllerImpl::UnregisterTracingUI(TracingUI* tracing_ui) { |
912 std::set<TracingUI*>::iterator it = tracing_uis_.find(tracing_ui); | 842 std::set<TracingUI*>::iterator it = tracing_uis_.find(tracing_ui); |
913 DCHECK(it != tracing_uis_.end()); | 843 DCHECK(it != tracing_uis_.end()); |
914 tracing_uis_.erase(it); | 844 tracing_uis_.erase(it); |
915 } | 845 } |
916 | 846 |
847 std::string TracingControllerImpl::GetTracingAgentName() { | |
848 return kChromeTracingAgentName; | |
849 } | |
850 | |
851 bool TracingControllerImpl::StartAgentTracing( | |
852 const base::trace_event::TraceConfig& trace_config) { | |
853 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
854 | |
855 base::Closure on_start_tracing_done_callback = | |
856 base::Bind(&TracingControllerImpl::OnStartAgentTracingDone, | |
857 base::Unretained(this), | |
858 trace_config, start_tracing_done_callback_); | |
859 if (!BrowserThread::PostTask( | |
860 BrowserThread::FILE, FROM_HERE, | |
861 base::Bind(&TracingControllerImpl::SetEnabledOnFileThread, | |
862 base::Unretained(this), trace_config, | |
863 base::trace_event::TraceLog::RECORDING_MODE, | |
864 on_start_tracing_done_callback))) { | |
865 // BrowserThread::PostTask fails if the threads haven't been created yet, | |
866 // so it should be safe to just use TraceLog::SetEnabled directly. | |
867 base::trace_event::TraceLog::GetInstance()->SetEnabled( | |
868 trace_config, base::trace_event::TraceLog::RECORDING_MODE); | |
869 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | |
870 on_start_tracing_done_callback); | |
871 } | |
872 | |
873 return true; | |
874 } | |
875 | |
876 void TracingControllerImpl::StopAgentTracing( | |
877 const StopAgentTracingCallback& callback) { | |
878 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
879 // Handle special case of zero child processes by immediately flushing the | |
880 // trace log. Once the flush has completed the caller will be notified that | |
881 // tracing has ended. | |
882 if (pending_stop_tracing_ack_count_ == 1) { | |
883 // Flush/cancel asynchronously now, because we don't have any children to | |
884 // wait for. | |
885 if (trace_data_sink_) { | |
886 TraceLog::GetInstance()->Flush( | |
887 base::Bind(&TracingControllerImpl::OnLocalTraceDataCollected, | |
888 base::Unretained(this)), | |
889 true); | |
890 } else { | |
891 TraceLog::GetInstance()->CancelTracing( | |
892 base::Bind(&TracingControllerImpl::OnLocalTraceDataCollected, | |
893 base::Unretained(this))); | |
894 } | |
895 } | |
896 | |
897 // Notify all child processes. | |
898 for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); | |
899 it != trace_message_filters_.end(); ++it) { | |
900 if (trace_data_sink_) | |
901 it->get()->SendEndTracing(); | |
902 else | |
903 it->get()->SendCancelTracing(); | |
904 } | |
905 } | |
906 | |
907 bool TracingControllerImpl::SupportsExplicitClockSync() { | |
908 // TODO(zhenw): return true after implementing explicit clock sync. | |
909 return false; | |
910 } | |
911 | |
912 void TracingControllerImpl::RecordClockSyncMarker( | |
913 scoped_ptr<base::DictionaryValue> marker) { | |
914 DCHECK(SupportsExplicitClockSync()); | |
915 // TODO(zhenw): implement explicit clock sync. | |
916 } | |
917 | |
918 void TracingControllerImpl::IssueClockSyncMarker() { | |
919 DCHECK(SupportsExplicitClockSync()); | |
920 // TODO(zhenw): implement explicit clock sync. | |
921 } | |
922 | |
917 void TracingControllerImpl::RequestGlobalMemoryDump( | 923 void TracingControllerImpl::RequestGlobalMemoryDump( |
918 const base::trace_event::MemoryDumpRequestArgs& args, | 924 const base::trace_event::MemoryDumpRequestArgs& args, |
919 const base::trace_event::MemoryDumpCallback& callback) { | 925 const base::trace_event::MemoryDumpCallback& callback) { |
920 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 926 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
921 BrowserThread::PostTask( | 927 BrowserThread::PostTask( |
922 BrowserThread::UI, FROM_HERE, | 928 BrowserThread::UI, FROM_HERE, |
923 base::Bind(&TracingControllerImpl::RequestGlobalMemoryDump, | 929 base::Bind(&TracingControllerImpl::RequestGlobalMemoryDump, |
924 base::Unretained(this), args, callback)); | 930 base::Unretained(this), args, callback)); |
925 return; | 931 return; |
926 } | 932 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1043 is_monitoring_ = is_monitoring; | 1049 is_monitoring_ = is_monitoring; |
1044 #if !defined(OS_ANDROID) | 1050 #if !defined(OS_ANDROID) |
1045 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); | 1051 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); |
1046 it != tracing_uis_.end(); it++) { | 1052 it != tracing_uis_.end(); it++) { |
1047 (*it)->OnMonitoringStateChanged(is_monitoring); | 1053 (*it)->OnMonitoringStateChanged(is_monitoring); |
1048 } | 1054 } |
1049 #endif | 1055 #endif |
1050 } | 1056 } |
1051 | 1057 |
1052 } // namespace content | 1058 } // namespace content |
OLD | NEW |