Move some users to use webrtc::RefCountInterface

Bug: webrtc:15622
Change-Id: I2d4c20c726af1a052e161b7689a73d1e5e3eb191
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/325526
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41067}
diff --git a/api/audio_codecs/BUILD.gn b/api/audio_codecs/BUILD.gn
index 82ed31a..158ab74 100644
--- a/api/audio_codecs/BUILD.gn
+++ b/api/audio_codecs/BUILD.gn
@@ -32,6 +32,7 @@
     "..:array_view",
     "..:bitrate_allocation",
     "..:make_ref_counted",
+    "..:ref_count",
     "..:scoped_refptr",
     "../../api:field_trials_view",
     "../../rtc_base:buffer",
diff --git a/api/audio_codecs/audio_decoder_factory.h b/api/audio_codecs/audio_decoder_factory.h
index 2811f67..19b921a 100644
--- a/api/audio_codecs/audio_decoder_factory.h
+++ b/api/audio_codecs/audio_decoder_factory.h
@@ -18,12 +18,12 @@
 #include "api/audio_codecs/audio_codec_pair_id.h"
 #include "api/audio_codecs/audio_decoder.h"
 #include "api/audio_codecs/audio_format.h"
-#include "rtc_base/ref_count.h"
+#include "api/ref_count.h"
 
 namespace webrtc {
 
 // A factory that creates AudioDecoders.
-class AudioDecoderFactory : public rtc::RefCountInterface {
+class AudioDecoderFactory : public RefCountInterface {
  public:
   virtual std::vector<AudioCodecSpec> GetSupportedDecoders() = 0;
 
diff --git a/api/data_channel_interface.h b/api/data_channel_interface.h
index 0c10e9b..d2deace 100644
--- a/api/data_channel_interface.h
+++ b/api/data_channel_interface.h
@@ -116,7 +116,7 @@
   virtual ~DataChannelObserver() = default;
 };
 
-class RTC_EXPORT DataChannelInterface : public rtc::RefCountInterface {
+class RTC_EXPORT DataChannelInterface : public RefCountInterface {
  public:
   // C++ version of: https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelstate
   // Unlikely to change, but keep in sync with DataChannel.java:State and
diff --git a/api/stats/rtc_stats_report.h b/api/stats/rtc_stats_report.h
index 1dce4d8..632226e 100644
--- a/api/stats/rtc_stats_report.h
+++ b/api/stats/rtc_stats_report.h
@@ -124,7 +124,7 @@
   std::string ToJson() const;
 
  protected:
-  friend class rtc::RefCountedNonVirtual<RTCStatsReport>;
+  friend class RefCountedNonVirtual<RTCStatsReport>;
   ~RTCStatsReport() = default;
 
  private:
diff --git a/api/task_queue/task_queue_test.cc b/api/task_queue/task_queue_test.cc
index b02333e..cac7cd7 100644
--- a/api/task_queue/task_queue_test.cc
+++ b/api/task_queue/task_queue_test.cc
@@ -268,7 +268,7 @@
     explicit BlockingCounter(int initial_count) : count_(initial_count) {}
 
     void DecrementCount() {
-      if (count_.DecRef() == rtc::RefCountReleaseStatus::kDroppedLastRef) {
+      if (count_.DecRef() == webrtc::RefCountReleaseStatus::kDroppedLastRef) {
         event_.Set();
       }
     }
diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn
index 807fdcc..5ec689c 100644
--- a/api/video/BUILD.gn
+++ b/api/video/BUILD.gn
@@ -67,6 +67,7 @@
     ":video_rtp_headers",
     "..:array_view",
     "..:make_ref_counted",
+    "..:ref_count",
     "..:rtp_packet_info",
     "..:scoped_refptr",
     "..:video_track_source_constraints",
diff --git a/api/video/video_frame_buffer.h b/api/video/video_frame_buffer.h
index aaf7866..ca6e906 100644
--- a/api/video/video_frame_buffer.h
+++ b/api/video/video_frame_buffer.h
@@ -14,8 +14,8 @@
 #include <stdint.h>
 
 #include "api/array_view.h"
+#include "api/ref_count.h"
 #include "api/scoped_refptr.h"
-#include "rtc_base/ref_count.h"
 #include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
@@ -44,7 +44,7 @@
 // performance by providing an optimized path without intermediate conversions.
 // Frame metadata such as rotation and timestamp are stored in
 // webrtc::VideoFrame, and not here.
-class RTC_EXPORT VideoFrameBuffer : public rtc::RefCountInterface {
+class RTC_EXPORT VideoFrameBuffer : public webrtc::RefCountInterface {
  public:
   // New frame buffer types will be added conservatively when there is an
   // opportunity to optimize the path between some pair of video source and
diff --git a/modules/audio_device/BUILD.gn b/modules/audio_device/BUILD.gn
index a59ecec..6f52cf8 100644
--- a/modules/audio_device/BUILD.gn
+++ b/modules/audio_device/BUILD.gn
@@ -48,6 +48,7 @@
     "include/audio_device_defines.h",
   ]
   deps = [
+    "../../api:ref_count",
     "../../api:scoped_refptr",
     "../../api/task_queue",
     "../../rtc_base:checks",
diff --git a/modules/audio_device/include/audio_device.h b/modules/audio_device/include/audio_device.h
index 936ee6c..47d2aec 100644
--- a/modules/audio_device/include/audio_device.h
+++ b/modules/audio_device/include/audio_device.h
@@ -12,16 +12,16 @@
 #define MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_H_
 
 #include "absl/types/optional.h"
+#include "api/ref_count.h"
 #include "api/scoped_refptr.h"
 #include "api/task_queue/task_queue_factory.h"
 #include "modules/audio_device/include/audio_device_defines.h"
-#include "rtc_base/ref_count.h"
 
 namespace webrtc {
 
 class AudioDeviceModuleForTest;
 
-class AudioDeviceModule : public rtc::RefCountInterface {
+class AudioDeviceModule : public webrtc::RefCountInterface {
  public:
   enum AudioLayer {
     kPlatformDefaultAudio = 0,
diff --git a/modules/audio_device/include/fake_audio_device.h b/modules/audio_device/include/fake_audio_device.h
index 2322ce0..2a30317 100644
--- a/modules/audio_device/include/fake_audio_device.h
+++ b/modules/audio_device/include/fake_audio_device.h
@@ -23,8 +23,8 @@
   // references using scoped_refptr. Current code doesn't always use refcounting
   // for this class.
   void AddRef() const override {}
-  rtc::RefCountReleaseStatus Release() const override {
-    return rtc::RefCountReleaseStatus::kDroppedLastRef;
+  webrtc::RefCountReleaseStatus Release() const override {
+    return webrtc::RefCountReleaseStatus::kDroppedLastRef;
   }
 };
 
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index d497f9f..6aca7de 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -29,6 +29,7 @@
     ":audio_frame_view",
     ":audio_processing_statistics",
     "../../api:array_view",
+    "../../api:ref_count",
     "../../api:scoped_refptr",
     "../../api/audio:aec3_config",
     "../../api/audio:audio_frame_api",
diff --git a/modules/audio_processing/audio_processing_impl_unittest.cc b/modules/audio_processing/audio_processing_impl_unittest.cc
index 9e50f99..e03f966 100644
--- a/modules/audio_processing/audio_processing_impl_unittest.cc
+++ b/modules/audio_processing/audio_processing_impl_unittest.cc
@@ -48,7 +48,7 @@
   }
 
   MOCK_METHOD(void, AddRef, (), (const, override));
-  MOCK_METHOD(rtc::RefCountReleaseStatus, Release, (), (const, override));
+  MOCK_METHOD(RefCountReleaseStatus, Release, (), (const, override));
 };
 
 // Creates MockEchoControl instances and provides a raw pointer access to
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index f613a38..e322351 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -28,10 +28,10 @@
 #include "api/array_view.h"
 #include "api/audio/echo_canceller3_config.h"
 #include "api/audio/echo_control.h"
+#include "api/ref_count.h"
 #include "api/scoped_refptr.h"
 #include "modules/audio_processing/include/audio_processing_statistics.h"
 #include "rtc_base/arraysize.h"
-#include "rtc_base/ref_count.h"
 #include "rtc_base/system/file_wrapper.h"
 #include "rtc_base/system/rtc_export.h"
 
@@ -127,7 +127,7 @@
 // // Close the application...
 // apm.reset();
 //
-class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
+class RTC_EXPORT AudioProcessing : public RefCountInterface {
  public:
   // The struct below constitutes the new parameter scheme for the audio
   // processing. It is being introduced gradually and until it is fully
@@ -912,7 +912,7 @@
 };
 
 // Interface for an echo detector submodule.
-class EchoDetector : public rtc::RefCountInterface {
+class EchoDetector : public RefCountInterface {
  public:
   // (Re-)Initializes the submodule.
   virtual void Initialize(int capture_sample_rate_hz,
diff --git a/modules/video_capture/video_capture.h b/modules/video_capture/video_capture.h
index eddc314..48920b2 100644
--- a/modules/video_capture/video_capture.h
+++ b/modules/video_capture/video_capture.h
@@ -18,7 +18,7 @@
 
 namespace webrtc {
 
-class VideoCaptureModule : public rtc::RefCountInterface {
+class VideoCaptureModule : public RefCountInterface {
  public:
   // Interface for receiving information about available camera devices.
   class DeviceInfo {
diff --git a/net/dcsctp/socket/callback_deferrer.cc b/net/dcsctp/socket/callback_deferrer.cc
index 123526e..1b4ba00 100644
--- a/net/dcsctp/socket/callback_deferrer.cc
+++ b/net/dcsctp/socket/callback_deferrer.cc
@@ -28,7 +28,7 @@
   }
 
  private:
-  struct State : public rtc::RefCountInterface {
+  struct State : public webrtc::RefCountInterface {
     explicit State(DcSctpMessage&& m)
         : has_delivered(false), message(std::move(m)) {}
     bool has_delivered;
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 6e885a9..67d2b86 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -1971,6 +1971,7 @@
         ":zero_memory",
         "../api:array_view",
         "../api:make_ref_counted",
+        "../api:ref_count",
         "../api:scoped_refptr",
         "../api/numerics",
         "../api/units:data_rate",
diff --git a/rtc_tools/BUILD.gn b/rtc_tools/BUILD.gn
index bca744e..1ab7a98 100644
--- a/rtc_tools/BUILD.gn
+++ b/rtc_tools/BUILD.gn
@@ -54,6 +54,7 @@
   ]
   deps = [
     "../api:make_ref_counted",
+    "../api:ref_count",
     "../api:scoped_refptr",
     "../api/video:video_frame",
     "../api/video:video_rtp_headers",
diff --git a/rtc_tools/video_file_reader.h b/rtc_tools/video_file_reader.h
index 1293beb..270955b 100644
--- a/rtc_tools/video_file_reader.h
+++ b/rtc_tools/video_file_reader.h
@@ -16,16 +16,16 @@
 #include <iterator>
 #include <string>
 
+#include "api/ref_count.h"
 #include "api/scoped_refptr.h"
 #include "api/video/video_frame_buffer.h"
-#include "rtc_base/ref_count.h"
 
 namespace webrtc {
 namespace test {
 
 // Iterable class representing a sequence of I420 buffers. This class is not
 // thread safe because it is expected to be backed by a file.
-class Video : public rtc::RefCountInterface {
+class Video : public RefCountInterface {
  public:
   class Iterator {
    public: