Index: content/browser/tracing/tracing_controller_impl.cc |
diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc |
index 1340b67e99237802b01190d46d470232eaf02bbe..a1c3148cbbfa19cd841a35681bab1b6c2400e7fc 100644 |
--- a/content/browser/tracing/tracing_controller_impl.cc |
+++ b/content/browser/tracing/tracing_controller_impl.cc |
@@ -114,6 +114,7 @@ TracingControllerImpl::TracingControllerImpl() : |
pending_disable_recording_ack_count_(0), |
pending_capture_monitoring_snapshot_ack_count_(0), |
pending_trace_buffer_percent_full_ack_count_(0), |
+ pending_configure_synthetic_delay_ack_count_(0), |
maximum_trace_buffer_percent_full_(0), |
// Tracing may have been enabled by ContentMainRunner if kTraceStartup |
// is specified in command line. |
@@ -356,6 +357,31 @@ bool TracingControllerImpl::GetTraceBufferPercentFull( |
return true; |
} |
+void TracingControllerImpl::ConfigureSyntheticDelay( |
nduca
2013/11/24 19:42:00
i think you need to configure them all in one go,
|
+ const std::string& name, |
+ base::TimeDelta target_duration, |
+ base::debug::TraceEventSyntheticDelay::Mode mode, |
+ const ConfigureSyntheticDelayCallback& callback) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ base::debug::TraceEventSyntheticDelay* delay = |
+ base::debug::TraceEventSyntheticDelay::Lookup(name); |
+ delay->SetTargetDuration(target_duration); |
+ delay->SetMode(mode); |
+ |
+ pending_configure_synthetic_delay_callback_ = callback; |
+ pending_configure_synthetic_delay_ack_count_ = filters_.size() + 1; |
+ |
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
+ base::Bind(&TracingControllerImpl::OnConfigureSyntheticDelayAcked, |
+ base::Unretained(this))); |
+ |
+ // Notify all child processes. |
+ for (FilterMap::iterator it = filters_.begin(); it != filters_.end(); ++it) { |
+ it->get()->SendConfigureSyntheticDelay(name, target_duration, mode); |
+ } |
+} |
+ |
void TracingControllerImpl::AddFilter(TraceMessageFilter* filter) { |
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
@@ -569,4 +595,21 @@ void TracingControllerImpl::OnTraceBufferPercentFullReply(float percent_full) { |
} |
} |
+void TracingControllerImpl::OnConfigureSyntheticDelayAcked() { |
+ if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
+ base::Bind(&TracingControllerImpl::OnConfigureSyntheticDelayAcked, |
+ base::Unretained(this))); |
+ return; |
+ } |
+ |
+ if (pending_configure_synthetic_delay_ack_count_ == 0) |
+ return; |
+ |
+ if (--pending_configure_synthetic_delay_ack_count_ != 0) |
+ return; |
+ |
+ pending_configure_synthetic_delay_callback_.Run(); |
+} |
+ |
} // namespace content |