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}
diff --git a/api/stats_types.cc b/api/stats_types.cc
index 6e62bba7..ddba593 100644
--- a/api/stats_types.cc
+++ b/api/stats_types.cc
@@ -23,8 +23,6 @@
 // generate strongly typed inline C++ code that forces the correct type to be
 // used for a given name at compile time.
 
-using rtc::RefCountedObject;
-
 namespace webrtc {
 namespace {
 
@@ -690,17 +688,17 @@
 
 // static
 StatsReport::Id StatsReport::NewBandwidthEstimationId() {
-  return Id(new RefCountedObject<BandwidthEstimationId>());
+  return rtc::make_ref_counted<BandwidthEstimationId>();
 }
 
 // static
 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
 StatsReport::Id StatsReport::NewTypedIntId(StatsType type, int id) {
-  return Id(new RefCountedObject<TypedIntId>(type, id));
+  return rtc::make_ref_counted<TypedIntId>(type, id);
 }
 
 // static
@@ -708,26 +706,25 @@
     StatsType type,
     const std::string& id,
     StatsReport::Direction direction) {
-  return Id(new RefCountedObject<IdWithDirection>(type, id, direction));
+  return rtc::make_ref_counted<IdWithDirection>(type, id, direction);
 }
 
 // static
 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
 StatsReport::Id StatsReport::NewComponentId(const std::string& content_name,
                                             int component) {
-  return Id(new RefCountedObject<ComponentId>(content_name, component));
+  return rtc::make_ref_counted<ComponentId>(content_name, component);
 }
 
 // static
 StatsReport::Id StatsReport::NewCandidatePairId(const std::string& content_name,
                                                 int component,
                                                 int index) {
-  return Id(
-      new RefCountedObject<CandidatePairId>(content_name, component, index));
+  return rtc::make_ref_counted<CandidatePairId>(content_name, component, index);
 }
 
 const char* StatsReport::TypeToString() const {