Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(620)

Unified Diff: webrtc/api/rtcstatscollector.cc

Issue 2583613003: Fix segfault when PeerConnection is destroyed during stats collection. (Closed)
Patch Set: DCHECK in destructor added Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/rtcstatscollector.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « webrtc/api/rtcstatscollector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698