Deliver cached stats reports asynchronously.

This has the following benefits:
* Stats reports are always delivered asynchronously. This means the API
  client doesn't need to worry about *possibly* getting a synchronous
  callback depending on when the last report was generated.
* Stats callbacks will always be invoked in the same order that the
  GetStats calls were made, even in cases where a callback recursively
  calls GetStats again.

Bug: webrtc:8973
Change-Id: I94ca4b5dc5c21a8f2df42adfcddf357f40a32025
Reviewed-on: https://webrtc-review.googlesource.com/60473
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22348}
This commit is contained in:
Taylor Brandstetter
2018-03-08 09:53:47 -08:00
committed by Commit Bot
parent 6328d7cbbc
commit 25e022fd5c
3 changed files with 32 additions and 20 deletions

View File

@ -94,7 +94,9 @@ class RTCStatsCollector : public virtual rtc::RefCountInterface,
};
void AddPartialResults_s(rtc::scoped_refptr<RTCStatsReport> partial_report);
void DeliverCachedReport();
void DeliverCachedReport(
rtc::scoped_refptr<const RTCStatsReport> cached_report,
std::vector<rtc::scoped_refptr<RTCStatsCollectorCallback>> callbacks);
// Produces |RTCCertificateStats|.
void ProduceCertificateStats_n(