From 78f905e5cccf4a6105c0d246a6104a2bf5bb1cd2 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Thu, 2 Nov 2023 14:09:26 +0000 Subject: [PATCH] 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 Commit-Queue: Harald Alvestrand Cr-Commit-Position: refs/heads/main@{#41067} --- api/audio_codecs/BUILD.gn | 1 + api/audio_codecs/audio_decoder_factory.h | 4 ++-- api/data_channel_interface.h | 2 +- api/stats/rtc_stats_report.h | 2 +- api/task_queue/task_queue_test.cc | 2 +- api/video/BUILD.gn | 1 + api/video/video_frame_buffer.h | 4 ++-- modules/audio_device/BUILD.gn | 1 + modules/audio_device/include/audio_device.h | 4 ++-- modules/audio_device/include/fake_audio_device.h | 4 ++-- modules/audio_processing/BUILD.gn | 1 + modules/audio_processing/audio_processing_impl_unittest.cc | 2 +- modules/audio_processing/include/audio_processing.h | 6 +++--- modules/video_capture/video_capture.h | 2 +- net/dcsctp/socket/callback_deferrer.cc | 2 +- rtc_base/BUILD.gn | 1 + rtc_tools/BUILD.gn | 1 + rtc_tools/video_file_reader.h | 4 ++-- 18 files changed, 25 insertions(+), 19 deletions(-) diff --git a/api/audio_codecs/BUILD.gn b/api/audio_codecs/BUILD.gn index 82ed31a5da..158ab74cce 100644 --- a/api/audio_codecs/BUILD.gn +++ b/api/audio_codecs/BUILD.gn @@ -32,6 +32,7 @@ rtc_library("audio_codecs_api") { "..: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 2811f6704b..19b921a97f 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 GetSupportedDecoders() = 0; diff --git a/api/data_channel_interface.h b/api/data_channel_interface.h index 0c10e9b73d..d2deace2e6 100644 --- a/api/data_channel_interface.h +++ b/api/data_channel_interface.h @@ -116,7 +116,7 @@ class DataChannelObserver { 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 1dce4d89b2..632226ef0d 100644 --- a/api/stats/rtc_stats_report.h +++ b/api/stats/rtc_stats_report.h @@ -124,7 +124,7 @@ class RTC_EXPORT RTCStatsReport final std::string ToJson() const; protected: - friend class rtc::RefCountedNonVirtual; + friend class RefCountedNonVirtual; ~RTCStatsReport() = default; private: diff --git a/api/task_queue/task_queue_test.cc b/api/task_queue/task_queue_test.cc index b02333ec58..cac7cd77cc 100644 --- a/api/task_queue/task_queue_test.cc +++ b/api/task_queue/task_queue_test.cc @@ -268,7 +268,7 @@ TEST_P(TaskQueueTest, PostALot) { 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 807fdcc3a9..5ec689c096 100644 --- a/api/video/BUILD.gn +++ b/api/video/BUILD.gn @@ -67,6 +67,7 @@ rtc_library("video_frame") { ":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 aaf786699f..ca6e9067db 100644 --- a/api/video/video_frame_buffer.h +++ b/api/video/video_frame_buffer.h @@ -14,8 +14,8 @@ #include #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 @@ class NV12BufferInterface; // 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 a59ecec504..6f52cf8af1 100644 --- a/modules/audio_device/BUILD.gn +++ b/modules/audio_device/BUILD.gn @@ -48,6 +48,7 @@ rtc_source_set("audio_device_api") { "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 936ee6cb04..47d2aecfa7 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 2322ce0263..2a303173e9 100644 --- a/modules/audio_device/include/fake_audio_device.h +++ b/modules/audio_device/include/fake_audio_device.h @@ -23,8 +23,8 @@ class FakeAudioDeviceModule // 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 d497f9fcdc..6aca7dee46 100644 --- a/modules/audio_processing/BUILD.gn +++ b/modules/audio_processing/BUILD.gn @@ -29,6 +29,7 @@ rtc_library("api") { ":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 9e50f994b1..e03f966b06 100644 --- a/modules/audio_processing/audio_processing_impl_unittest.cc +++ b/modules/audio_processing/audio_processing_impl_unittest.cc @@ -48,7 +48,7 @@ class MockInitialize : public AudioProcessingImpl { } 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 f613a38de1..e3223513af 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 @@ class CustomProcessing; // // 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 @@ class CustomProcessing { }; // 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 eddc31414a..48920b27c0 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 123526e782..1b4ba00658 100644 --- a/net/dcsctp/socket/callback_deferrer.cc +++ b/net/dcsctp/socket/callback_deferrer.cc @@ -28,7 +28,7 @@ class MessageDeliverer { } 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 6e885a9b1b..67d2b86de5 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -1971,6 +1971,7 @@ if (rtc_include_tests) { ":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 bca744e0c0..1ab7a98936 100644 --- a/rtc_tools/BUILD.gn +++ b/rtc_tools/BUILD.gn @@ -54,6 +54,7 @@ rtc_library("video_file_reader") { ] 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 1293beba2f..270955b5f5 100644 --- a/rtc_tools/video_file_reader.h +++ b/rtc_tools/video_file_reader.h @@ -16,16 +16,16 @@ #include #include +#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: