| 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" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
| 13 #include "base/thread_task_runner_handle.h" |
| 14 #include "base/time/time.h" |
| 13 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 14 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 15 #include "content/browser/tracing/file_tracing_provider_impl.h" | 17 #include "content/browser/tracing/file_tracing_provider_impl.h" |
| 16 #include "content/browser/tracing/power_tracing_agent.h" | 18 #include "content/browser/tracing/power_tracing_agent.h" |
| 17 #include "content/browser/tracing/trace_message_filter.h" | 19 #include "content/browser/tracing/trace_message_filter.h" |
| 18 #include "content/browser/tracing/tracing_ui.h" | 20 #include "content/browser/tracing/tracing_ui.h" |
| 19 #include "content/common/child_process_messages.h" | 21 #include "content/common/child_process_messages.h" |
| 20 #include "content/public/browser/browser_message_filter.h" | 22 #include "content/public/browser/browser_message_filter.h" |
| 21 #include "content/public/browser/content_browser_client.h" | 23 #include "content/public/browser/content_browser_client.h" |
| 22 #include "content/public/browser/gpu_data_manager.h" | 24 #include "content/public/browser/gpu_data_manager.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 43 | 45 |
| 44 namespace { | 46 namespace { |
| 45 | 47 |
| 46 base::LazyInstance<TracingControllerImpl>::Leaky g_controller = | 48 base::LazyInstance<TracingControllerImpl>::Leaky g_controller = |
| 47 LAZY_INSTANCE_INITIALIZER; | 49 LAZY_INSTANCE_INITIALIZER; |
| 48 | 50 |
| 49 const char kChromeTracingAgentName[] = "chrome"; | 51 const char kChromeTracingAgentName[] = "chrome"; |
| 50 const char kETWTracingAgentName[] = "etw"; | 52 const char kETWTracingAgentName[] = "etw"; |
| 51 const char kChromeTraceLabel[] = "traceEvents"; | 53 const char kChromeTraceLabel[] = "traceEvents"; |
| 52 | 54 |
| 53 const int kIssueClockSyncTimeout = 30; | 55 const int kStartTracingTimeout = 30; |
| 56 const int kIssueClockSyncTimeoutSeconds = 30; |
| 57 const int kStopTracingRetryTimeMilliseconds = 100; |
| 54 | 58 |
| 55 std::string GetNetworkTypeString() { | 59 std::string GetNetworkTypeString() { |
| 56 switch (net::NetworkChangeNotifier::GetConnectionType()) { | 60 switch (net::NetworkChangeNotifier::GetConnectionType()) { |
| 57 case net::NetworkChangeNotifier::CONNECTION_ETHERNET: | 61 case net::NetworkChangeNotifier::CONNECTION_ETHERNET: |
| 58 return "Ethernet"; | 62 return "Ethernet"; |
| 59 case net::NetworkChangeNotifier::CONNECTION_WIFI: | 63 case net::NetworkChangeNotifier::CONNECTION_WIFI: |
| 60 return "WiFi"; | 64 return "WiFi"; |
| 61 case net::NetworkChangeNotifier::CONNECTION_2G: | 65 case net::NetworkChangeNotifier::CONNECTION_2G: |
| 62 return "2G"; | 66 return "2G"; |
| 63 case net::NetworkChangeNotifier::CONNECTION_3G: | 67 case net::NetworkChangeNotifier::CONNECTION_3G: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 return metadata_dict; | 141 return metadata_dict; |
| 138 } | 142 } |
| 139 | 143 |
| 140 } // namespace | 144 } // namespace |
| 141 | 145 |
| 142 TracingController* TracingController::GetInstance() { | 146 TracingController* TracingController::GetInstance() { |
| 143 return TracingControllerImpl::GetInstance(); | 147 return TracingControllerImpl::GetInstance(); |
| 144 } | 148 } |
| 145 | 149 |
| 146 TracingControllerImpl::TracingControllerImpl() | 150 TracingControllerImpl::TracingControllerImpl() |
| 147 : pending_stop_tracing_ack_count_(0), | 151 : pending_start_tracing_ack_count_(0), |
| 152 pending_stop_tracing_ack_count_(0), |
| 148 pending_capture_monitoring_snapshot_ack_count_(0), | 153 pending_capture_monitoring_snapshot_ack_count_(0), |
| 149 pending_trace_log_status_ack_count_(0), | 154 pending_trace_log_status_ack_count_(0), |
| 150 maximum_trace_buffer_usage_(0), | 155 maximum_trace_buffer_usage_(0), |
| 151 approximate_event_count_(0), | 156 approximate_event_count_(0), |
| 152 pending_memory_dump_ack_count_(0), | 157 pending_memory_dump_ack_count_(0), |
| 153 failed_memory_dump_count_(0), | 158 failed_memory_dump_count_(0), |
| 154 clock_sync_id_(0), | 159 clock_sync_id_(0), |
| 155 pending_clock_sync_ack_count_(0), | 160 pending_clock_sync_ack_count_(0), |
| 156 is_tracing_(false), | 161 is_tracing_(false), |
| 157 is_monitoring_(false) { | 162 is_monitoring_(false) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 bool TracingControllerImpl::StartTracing( | 216 bool TracingControllerImpl::StartTracing( |
| 212 const TraceConfig& trace_config, | 217 const TraceConfig& trace_config, |
| 213 const StartTracingDoneCallback& callback) { | 218 const StartTracingDoneCallback& callback) { |
| 214 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 219 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 215 DCHECK(additional_tracing_agents_.empty()); | 220 DCHECK(additional_tracing_agents_.empty()); |
| 216 | 221 |
| 217 if (!can_start_tracing()) | 222 if (!can_start_tracing()) |
| 218 return false; | 223 return false; |
| 219 is_tracing_ = true; | 224 is_tracing_ = true; |
| 220 start_tracing_done_callback_ = callback; | 225 start_tracing_done_callback_ = callback; |
| 226 start_tracing_trace_config_.reset( |
| 227 new base::trace_event::TraceConfig(trace_config)); |
| 228 pending_start_tracing_ack_count_ = 0; |
| 221 | 229 |
| 222 #if defined(OS_ANDROID) | 230 #if defined(OS_ANDROID) |
| 223 if (pending_get_categories_done_callback_.is_null()) | 231 if (pending_get_categories_done_callback_.is_null()) |
| 224 TraceLog::GetInstance()->AddClockSyncMetadataEvent(); | 232 TraceLog::GetInstance()->AddClockSyncMetadataEvent(); |
| 225 #endif | 233 #endif |
| 226 | 234 |
| 227 if (trace_config.IsSystraceEnabled()) { | 235 if (trace_config.IsSystraceEnabled()) { |
| 228 if (PowerTracingAgent::GetInstance()->StartAgentTracing(trace_config)) | 236 PowerTracingAgent::GetInstance()->StartAgentTracing( |
| 229 additional_tracing_agents_.push_back(PowerTracingAgent::GetInstance()); | 237 trace_config, |
| 238 base::Bind(&TracingControllerImpl::OnStartAgentTracingAcked, |
| 239 base::Unretained(this))); |
| 240 ++pending_start_tracing_ack_count_; |
| 241 |
| 230 #if defined(OS_CHROMEOS) | 242 #if defined(OS_CHROMEOS) |
| 231 chromeos::DebugDaemonClient* debug_daemon = | 243 chromeos::DebugDaemonClient* debug_daemon = |
| 232 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); | 244 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); |
| 233 if (debug_daemon && debug_daemon->StartAgentTracing(trace_config)) { | 245 if (debug_daemon) { |
| 234 debug_daemon->SetStopAgentTracingTaskRunner( | 246 debug_daemon->StartAgentTracing( |
| 235 BrowserThread::GetBlockingPool()); | 247 trace_config, |
| 236 additional_tracing_agents_.push_back( | 248 base::Bind(&TracingControllerImpl::OnStartAgentTracingAcked, |
| 237 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()); | 249 base::Unretained(this))); |
| 250 ++pending_start_tracing_ack_count_; |
| 238 } | 251 } |
| 239 #elif defined(OS_WIN) | 252 #elif defined(OS_WIN) |
| 240 if (EtwSystemEventConsumer::GetInstance()->StartAgentTracing( | 253 EtwSystemEventConsumer::GetInstance()->StartAgentTracing( |
| 241 trace_config)) { | 254 trace_config, |
| 242 additional_tracing_agents_.push_back( | 255 base::Bind(&TracingControllerImpl::OnStartAgentTracingAcked, |
| 243 EtwSystemEventConsumer::GetInstance()); | 256 base::Unretained(this))); |
| 244 } | 257 ++pending_start_tracing_ack_count_; |
| 245 #endif | 258 #endif |
| 246 } | 259 } |
| 247 | 260 |
| 248 // TraceLog may have been enabled in startup tracing before threads are ready. | 261 // TraceLog may have been enabled in startup tracing before threads are ready. |
| 249 if (TraceLog::GetInstance()->IsEnabled()) | 262 if (TraceLog::GetInstance()->IsEnabled()) |
| 250 return true; | 263 return true; |
| 251 return StartAgentTracing(trace_config); | 264 |
| 265 StartAgentTracing(trace_config, |
| 266 base::Bind(&TracingControllerImpl::OnStartAgentTracingAcked, |
| 267 base::Unretained(this))); |
| 268 ++pending_start_tracing_ack_count_; |
| 269 |
| 270 // Set a deadline to ensure all agents ack within a reasonable time frame. |
| 271 start_tracing_timer_.Start( |
| 272 FROM_HERE, base::TimeDelta::FromSeconds(kStartTracingTimeout), |
| 273 base::Bind(&TracingControllerImpl::OnAllTracingAgentsStarted, |
| 274 base::Unretained(this))); |
| 275 |
| 276 return true; |
| 252 } | 277 } |
| 253 | 278 |
| 254 void TracingControllerImpl::OnStartAgentTracingDone( | 279 void TracingControllerImpl::OnAllTracingAgentsStarted() { |
| 255 const TraceConfig& trace_config) { | |
| 256 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 280 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 257 | 281 |
| 258 TRACE_EVENT_API_ADD_METADATA_EVENT("IsTimeTicksHighResolution", "value", | 282 TRACE_EVENT_API_ADD_METADATA_EVENT("IsTimeTicksHighResolution", "value", |
| 259 base::TimeTicks::IsHighResolution()); | 283 base::TimeTicks::IsHighResolution()); |
| 260 TRACE_EVENT_API_ADD_METADATA_EVENT("TraceConfig", "value", | 284 TRACE_EVENT_API_ADD_METADATA_EVENT( |
| 261 trace_config.AsConvertableToTraceFormat()); | 285 "TraceConfig", "value", |
| 286 start_tracing_trace_config_->AsConvertableToTraceFormat()); |
| 262 | 287 |
| 263 // Notify all child processes. | 288 // Notify all child processes. |
| 264 for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); | 289 for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); |
| 265 it != trace_message_filters_.end(); ++it) { | 290 it != trace_message_filters_.end(); ++it) { |
| 266 it->get()->SendBeginTracing(trace_config); | 291 it->get()->SendBeginTracing(*start_tracing_trace_config_); |
| 267 } | 292 } |
| 268 | 293 |
| 269 if (!start_tracing_done_callback_.is_null()) { | 294 if (!start_tracing_done_callback_.is_null()) |
| 270 start_tracing_done_callback_.Run(); | 295 start_tracing_done_callback_.Run(); |
| 271 start_tracing_done_callback_.Reset(); | 296 |
| 272 } | 297 start_tracing_done_callback_.Reset(); |
| 298 start_tracing_trace_config_.reset(); |
| 273 } | 299 } |
| 274 | 300 |
| 275 bool TracingControllerImpl::StopTracing( | 301 bool TracingControllerImpl::StopTracing( |
| 276 const scoped_refptr<TraceDataSink>& trace_data_sink) { | 302 const scoped_refptr<TraceDataSink>& trace_data_sink) { |
| 277 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 303 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 278 | 304 |
| 305 if (!can_stop_tracing()) |
| 306 return false; |
| 307 |
| 308 // If we're still waiting to start tracing, try again after a delay. |
| 309 if (start_tracing_timer_.IsRunning()) { |
| 310 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 311 FROM_HERE, |
| 312 base::Bind(base::IgnoreResult(&TracingControllerImpl::StopTracing), |
| 313 base::Unretained(this), trace_data_sink), |
| 314 base::TimeDelta::FromMilliseconds(kStopTracingRetryTimeMilliseconds)); |
| 315 return true; |
| 316 } |
| 317 |
| 279 if (trace_data_sink) { | 318 if (trace_data_sink) { |
| 280 if (TraceLog::GetInstance()->GetCurrentTraceConfig() | 319 if (TraceLog::GetInstance()->GetCurrentTraceConfig() |
| 281 .IsArgumentFilterEnabled()) { | 320 .IsArgumentFilterEnabled()) { |
| 282 scoped_ptr<TracingDelegate> delegate( | 321 scoped_ptr<TracingDelegate> delegate( |
| 283 GetContentClient()->browser()->GetTracingDelegate()); | 322 GetContentClient()->browser()->GetTracingDelegate()); |
| 284 if (delegate) { | 323 if (delegate) { |
| 285 trace_data_sink->SetMetadataFilterPredicate( | 324 trace_data_sink->SetMetadataFilterPredicate( |
| 286 delegate->GetMetadataFilterPredicate()); | 325 delegate->GetMetadataFilterPredicate()); |
| 287 } | 326 } |
| 288 } | 327 } |
| 289 trace_data_sink->AddMetadata(*GenerateTracingMetadataDict().get()); | 328 trace_data_sink->AddMetadata(*GenerateTracingMetadataDict().get()); |
| 290 } | 329 } |
| 291 | 330 |
| 292 if (!can_stop_tracing()) | |
| 293 return false; | |
| 294 | |
| 295 trace_data_sink_ = trace_data_sink; | 331 trace_data_sink_ = trace_data_sink; |
| 296 | 332 |
| 297 // Issue clock sync marker before actually stopping tracing. | 333 // Issue clock sync marker before actually stopping tracing. |
| 298 // StopTracingAfterClockSync() will be called after clock sync is done. | 334 // StopTracingAfterClockSync() will be called after clock sync is done. |
| 299 IssueClockSyncMarker(); | 335 IssueClockSyncMarker(); |
| 300 | 336 |
| 301 return true; | 337 return true; |
| 302 } | 338 } |
| 303 | 339 |
| 304 void TracingControllerImpl::StopTracingAfterClockSync() { | 340 void TracingControllerImpl::StopTracingAfterClockSync() { |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 BrowserThread::UI, FROM_HERE, | 665 BrowserThread::UI, FROM_HERE, |
| 630 base::Bind(&TracingControllerImpl::OnProcessMemoryDumpResponse, | 666 base::Bind(&TracingControllerImpl::OnProcessMemoryDumpResponse, |
| 631 base::Unretained(this), | 667 base::Unretained(this), |
| 632 make_scoped_refptr(trace_message_filter), | 668 make_scoped_refptr(trace_message_filter), |
| 633 pending_memory_dump_guid_, false /* success */)); | 669 pending_memory_dump_guid_, false /* success */)); |
| 634 } | 670 } |
| 635 } | 671 } |
| 636 trace_message_filters_.erase(trace_message_filter); | 672 trace_message_filters_.erase(trace_message_filter); |
| 637 } | 673 } |
| 638 | 674 |
| 675 void TracingControllerImpl::AddTracingAgent(const std::string& agent_name) { |
| 676 #if defined(OS_CHROMEOS) |
| 677 auto debug_daemon = |
| 678 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); |
| 679 if (agent_name == debug_daemon->GetTracingAgentName()) { |
| 680 additional_tracing_agents_.push_back(debug_daemon); |
| 681 debug_daemon->SetStopAgentTracingTaskRunner( |
| 682 BrowserThread::GetBlockingPool()); |
| 683 return; |
| 684 } |
| 685 #elif defined(OS_WIN) |
| 686 auto etw_agent = EtwSystemEventConsumer::GetInstance(); |
| 687 if (agent_name == etw_agent->GetTracingAgentName()) { |
| 688 additional_tracing_agents_.push_back(etw_agent); |
| 689 return; |
| 690 } |
| 691 #endif |
| 692 |
| 693 auto power_agent = PowerTracingAgent::GetInstance(); |
| 694 if (agent_name == power_agent->GetTracingAgentName()) { |
| 695 additional_tracing_agents_.push_back(power_agent); |
| 696 return; |
| 697 } |
| 698 |
| 699 DCHECK(agent_name == kChromeTracingAgentName); |
| 700 } |
| 701 |
| 702 void TracingControllerImpl::OnStartAgentTracingAcked( |
| 703 const std::string& agent_name, |
| 704 bool success) { |
| 705 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 706 |
| 707 // Don't taken any further action if the ack came after the deadline. |
| 708 if (!start_tracing_timer_.IsRunning()) |
| 709 return; |
| 710 |
| 711 if (success) |
| 712 AddTracingAgent(agent_name); |
| 713 |
| 714 if (--pending_start_tracing_ack_count_ == 0) { |
| 715 start_tracing_timer_.Stop(); |
| 716 OnAllTracingAgentsStarted(); |
| 717 } |
| 718 } |
| 719 |
| 639 void TracingControllerImpl::OnStopTracingAcked( | 720 void TracingControllerImpl::OnStopTracingAcked( |
| 640 TraceMessageFilter* trace_message_filter, | 721 TraceMessageFilter* trace_message_filter, |
| 641 const std::vector<std::string>& known_category_groups) { | 722 const std::vector<std::string>& known_category_groups) { |
| 642 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 723 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 643 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 724 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 644 base::Bind(&TracingControllerImpl::OnStopTracingAcked, | 725 base::Bind(&TracingControllerImpl::OnStopTracingAcked, |
| 645 base::Unretained(this), | 726 base::Unretained(this), |
| 646 make_scoped_refptr(trace_message_filter), | 727 make_scoped_refptr(trace_message_filter), |
| 647 known_category_groups)); | 728 known_category_groups)); |
| 648 return; | 729 return; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 } | 950 } |
| 870 | 951 |
| 871 std::string TracingControllerImpl::GetTracingAgentName() { | 952 std::string TracingControllerImpl::GetTracingAgentName() { |
| 872 return kChromeTracingAgentName; | 953 return kChromeTracingAgentName; |
| 873 } | 954 } |
| 874 | 955 |
| 875 std::string TracingControllerImpl::GetTraceEventLabel() { | 956 std::string TracingControllerImpl::GetTraceEventLabel() { |
| 876 return kChromeTraceLabel; | 957 return kChromeTraceLabel; |
| 877 } | 958 } |
| 878 | 959 |
| 879 bool TracingControllerImpl::StartAgentTracing( | 960 void TracingControllerImpl::StartAgentTracing( |
| 880 const base::trace_event::TraceConfig& trace_config) { | 961 const base::trace_event::TraceConfig& trace_config, |
| 962 const StartAgentTracingCallback& callback) { |
| 881 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 963 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 882 | 964 |
| 883 base::Closure on_start_tracing_done_callback = | 965 base::Closure on_agent_started = |
| 884 base::Bind(&TracingControllerImpl::OnStartAgentTracingDone, | 966 base::Bind(callback, kChromeTracingAgentName, true); |
| 885 base::Unretained(this), trace_config); | |
| 886 if (!BrowserThread::PostTask( | 967 if (!BrowserThread::PostTask( |
| 887 BrowserThread::FILE, FROM_HERE, | 968 BrowserThread::FILE, FROM_HERE, |
| 888 base::Bind(&TracingControllerImpl::SetEnabledOnFileThread, | 969 base::Bind(&TracingControllerImpl::SetEnabledOnFileThread, |
| 889 base::Unretained(this), trace_config, | 970 base::Unretained(this), trace_config, |
| 890 base::trace_event::TraceLog::RECORDING_MODE, | 971 base::trace_event::TraceLog::RECORDING_MODE, |
| 891 on_start_tracing_done_callback))) { | 972 on_agent_started))) { |
| 892 // BrowserThread::PostTask fails if the threads haven't been created yet, | 973 // BrowserThread::PostTask fails if the threads haven't been created yet, |
| 893 // so it should be safe to just use TraceLog::SetEnabled directly. | 974 // so it should be safe to just use TraceLog::SetEnabled directly. |
| 894 base::trace_event::TraceLog::GetInstance()->SetEnabled( | 975 base::trace_event::TraceLog::GetInstance()->SetEnabled( |
| 895 trace_config, base::trace_event::TraceLog::RECORDING_MODE); | 976 trace_config, base::trace_event::TraceLog::RECORDING_MODE); |
| 896 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 977 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, on_agent_started); |
| 897 on_start_tracing_done_callback); | |
| 898 } | 978 } |
| 899 | |
| 900 return true; | |
| 901 } | 979 } |
| 902 | 980 |
| 903 void TracingControllerImpl::StopAgentTracing( | 981 void TracingControllerImpl::StopAgentTracing( |
| 904 const StopAgentTracingCallback& callback) { | 982 const StopAgentTracingCallback& callback) { |
| 905 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 983 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 906 // Handle special case of zero child processes by immediately flushing the | 984 // Handle special case of zero child processes by immediately flushing the |
| 907 // trace log. Once the flush has completed the caller will be notified that | 985 // trace log. Once the flush has completed the caller will be notified that |
| 908 // tracing has ended. | 986 // tracing has ended. |
| 909 if (pending_stop_tracing_ack_count_ == 1) { | 987 if (pending_stop_tracing_ack_count_ == 1) { |
| 910 // Flush/cancel asynchronously now, because we don't have any children to | 988 // Flush/cancel asynchronously now, because we don't have any children to |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 } | 1040 } |
| 963 } | 1041 } |
| 964 | 1042 |
| 965 // If no clock sync is needed, stop tracing right away. Otherwise, schedule | 1043 // If no clock sync is needed, stop tracing right away. Otherwise, schedule |
| 966 // to stop tracing after timeout. | 1044 // to stop tracing after timeout. |
| 967 if (pending_clock_sync_ack_count_ == 0) { | 1045 if (pending_clock_sync_ack_count_ == 0) { |
| 968 StopTracingAfterClockSync(); | 1046 StopTracingAfterClockSync(); |
| 969 } else { | 1047 } else { |
| 970 clock_sync_timer_.Start( | 1048 clock_sync_timer_.Start( |
| 971 FROM_HERE, | 1049 FROM_HERE, |
| 972 base::TimeDelta::FromSeconds(kIssueClockSyncTimeout), | 1050 base::TimeDelta::FromSeconds(kIssueClockSyncTimeoutSeconds), |
| 973 this, | 1051 this, |
| 974 &TracingControllerImpl::StopTracingAfterClockSync); | 1052 &TracingControllerImpl::StopTracingAfterClockSync); |
| 975 } | 1053 } |
| 976 } | 1054 } |
| 977 | 1055 |
| 978 void TracingControllerImpl::OnClockSyncMarkerRecordedByAgent( | 1056 void TracingControllerImpl::OnClockSyncMarkerRecordedByAgent( |
| 979 int sync_id, | 1057 int sync_id, |
| 980 const base::TimeTicks& issue_ts, | 1058 const base::TimeTicks& issue_ts, |
| 981 const base::TimeTicks& issue_end_ts) { | 1059 const base::TimeTicks& issue_end_ts) { |
| 982 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1060 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 is_monitoring_ = is_monitoring; | 1201 is_monitoring_ = is_monitoring; |
| 1124 #if !defined(OS_ANDROID) | 1202 #if !defined(OS_ANDROID) |
| 1125 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); | 1203 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); |
| 1126 it != tracing_uis_.end(); it++) { | 1204 it != tracing_uis_.end(); it++) { |
| 1127 (*it)->OnMonitoringStateChanged(is_monitoring); | 1205 (*it)->OnMonitoringStateChanged(is_monitoring); |
| 1128 } | 1206 } |
| 1129 #endif | 1207 #endif |
| 1130 } | 1208 } |
| 1131 | 1209 |
| 1132 } // namespace content | 1210 } // namespace content |
| OLD | NEW |