Update stats_types.cc to use make_ref_counted.

Bug: webrtc:12701
Change-Id: I2db12680ae35359e02627edfea5f67910c39c431
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226740
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34715}
This commit is contained in:
Niels Möller 2021-07-22 10:08:25 +02:00 committed by WebRTC LUCI CQ
parent 6c02c33df9
commit bf75041b8d

View file

@ -23,8 +23,6 @@
// generate strongly typed inline C++ code that forces the correct type to be // generate strongly typed inline C++ code that forces the correct type to be
// used for a given name at compile time. // used for a given name at compile time.
using rtc::RefCountedObject;
namespace webrtc { namespace webrtc {
namespace { namespace {
@ -690,17 +688,17 @@ StatsReport::~StatsReport() = default;
// static // static
StatsReport::Id StatsReport::NewBandwidthEstimationId() { StatsReport::Id StatsReport::NewBandwidthEstimationId() {
return Id(new RefCountedObject<BandwidthEstimationId>()); return rtc::make_ref_counted<BandwidthEstimationId>();
} }
// static // static
StatsReport::Id StatsReport::NewTypedId(StatsType type, const std::string& id) { StatsReport::Id StatsReport::NewTypedId(StatsType type, const std::string& id) {
return Id(new RefCountedObject<TypedId>(type, id)); return rtc::make_ref_counted<TypedId>(type, id);
} }
// static // static
StatsReport::Id StatsReport::NewTypedIntId(StatsType type, int id) { StatsReport::Id StatsReport::NewTypedIntId(StatsType type, int id) {
return Id(new RefCountedObject<TypedIntId>(type, id)); return rtc::make_ref_counted<TypedIntId>(type, id);
} }
// static // static
@ -708,26 +706,25 @@ StatsReport::Id StatsReport::NewIdWithDirection(
StatsType type, StatsType type,
const std::string& id, const std::string& id,
StatsReport::Direction direction) { StatsReport::Direction direction) {
return Id(new RefCountedObject<IdWithDirection>(type, id, direction)); return rtc::make_ref_counted<IdWithDirection>(type, id, direction);
} }
// static // static
StatsReport::Id StatsReport::NewCandidateId(bool local, const std::string& id) { StatsReport::Id StatsReport::NewCandidateId(bool local, const std::string& id) {
return Id(new RefCountedObject<CandidateId>(local, id)); return rtc::make_ref_counted<CandidateId>(local, id);
} }
// static // static
StatsReport::Id StatsReport::NewComponentId(const std::string& content_name, StatsReport::Id StatsReport::NewComponentId(const std::string& content_name,
int component) { int component) {
return Id(new RefCountedObject<ComponentId>(content_name, component)); return rtc::make_ref_counted<ComponentId>(content_name, component);
} }
// static // static
StatsReport::Id StatsReport::NewCandidatePairId(const std::string& content_name, StatsReport::Id StatsReport::NewCandidatePairId(const std::string& content_name,
int component, int component,
int index) { int index) {
return Id( return rtc::make_ref_counted<CandidatePairId>(content_name, component, index);
new RefCountedObject<CandidatePairId>(content_name, component, index));
} }
const char* StatsReport::TypeToString() const { const char* StatsReport::TypeToString() const {