Remove virtual inheritance from RTCStatsCollector

Bug: none
Change-Id: I5c3d93f3cc64c588c2f8e750c70c51c991736023
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215961
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33814}
This commit is contained in:
Tomas Gunnarsson
2021-04-22 18:16:35 +02:00
committed by Commit Bot
parent 0c3b9098aa
commit e6de5ae2d6
3 changed files with 14 additions and 5 deletions

View File

@ -17,7 +17,7 @@
namespace webrtc {
class RTCStatsCollectorCallback : public virtual rtc::RefCountInterface {
class RTCStatsCollectorCallback : public rtc::RefCountInterface {
public:
~RTCStatsCollectorCallback() override = default;

View File

@ -53,7 +53,7 @@ class RtpReceiverInternal;
// Stats are gathered on the signaling, worker and network threads
// asynchronously. The callback is invoked on the signaling thread. Resulting
// reports are cached for |cache_lifetime_| ms.
class RTCStatsCollector : public virtual rtc::RefCountInterface,
class RTCStatsCollector : public rtc::RefCountInterface,
public sigslot::has_slots<> {
public:
static rtc::scoped_refptr<RTCStatsCollector> Create(

View File

@ -3215,11 +3215,20 @@ class FakeRTCStatsCollector : public RTCStatsCollector,
static rtc::scoped_refptr<FakeRTCStatsCollector> Create(
PeerConnectionInternal* pc,
int64_t cache_lifetime_us) {
return rtc::scoped_refptr<FakeRTCStatsCollector>(
new rtc::RefCountedObject<FakeRTCStatsCollector>(pc,
cache_lifetime_us));
return new rtc::RefCountedObject<FakeRTCStatsCollector>(pc,
cache_lifetime_us);
}
// Since FakeRTCStatsCollector inherits twice from RefCountInterface, once via
// RTCStatsCollector and once via RTCStatsCollectorCallback, scoped_refptr
// will get confused about which AddRef()/Release() methods to call.
// So to remove all doubt, we declare them here again in the class that we
// give to scoped_refptr.
// Satisfying the implementation of these methods and associating them with a
// reference counter, will be done by RefCountedObject.
virtual void AddRef() const = 0;
virtual rtc::RefCountReleaseStatus Release() const = 0;
// RTCStatsCollectorCallback implementation.
void OnStatsDelivered(
const rtc::scoped_refptr<const RTCStatsReport>& report) override {