Index: webrtc/api/rtcstatscollector.cc |
diff --git a/webrtc/api/rtcstatscollector.cc b/webrtc/api/rtcstatscollector.cc |
index a6d691c33339fd453ccf03175017e2422764e840..0cdff176b695c986f5c225a7179febfc72f8b2e3 100644 |
--- a/webrtc/api/rtcstatscollector.cc |
+++ b/webrtc/api/rtcstatscollector.cc |
@@ -389,6 +389,10 @@ RTCStatsCollector::RTCStatsCollector(PeerConnection* pc, |
this, &RTCStatsCollector::OnDataChannelCreated); |
} |
+RTCStatsCollector::~RTCStatsCollector() { |
+ RTC_DCHECK_EQ(num_pending_partial_reports_, 0); |
+} |
+ |
void RTCStatsCollector::GetStatsReport( |
rtc::scoped_refptr<RTCStatsCollectorCallback> callback) { |
RTC_DCHECK(signaling_thread_->IsCurrent()); |
@@ -430,6 +434,17 @@ void RTCStatsCollector::ClearCachedStatsReport() { |
cached_report_ = nullptr; |
} |
+void RTCStatsCollector::WaitForPendingRequest() { |
+ RTC_DCHECK(signaling_thread_->IsCurrent()); |
+ if (num_pending_partial_reports_) { |
+ rtc::Thread::Current()->ProcessMessages(0); |
+ while (num_pending_partial_reports_) { |
+ rtc::Thread::Current()->SleepMs(1); |
+ rtc::Thread::Current()->ProcessMessages(0); |
+ } |
+ } |
+} |
+ |
void RTCStatsCollector::ProducePartialResultsOnSignalingThread( |
int64_t timestamp_us) { |
RTC_DCHECK(signaling_thread_->IsCurrent()); |