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}
This commit is contained in:
Harald Alvestrand 2023-11-02 14:09:26 +00:00 committed by WebRTC LUCI CQ
parent 9aa115358e
commit 78f905e5cc
18 changed files with 25 additions and 19 deletions

View file

@ -32,6 +32,7 @@ rtc_library("audio_codecs_api") {
"..:array_view", "..:array_view",
"..:bitrate_allocation", "..:bitrate_allocation",
"..:make_ref_counted", "..:make_ref_counted",
"..:ref_count",
"..:scoped_refptr", "..:scoped_refptr",
"../../api:field_trials_view", "../../api:field_trials_view",
"../../rtc_base:buffer", "../../rtc_base:buffer",

View file

@ -18,12 +18,12 @@
#include "api/audio_codecs/audio_codec_pair_id.h" #include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h" #include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h" #include "api/audio_codecs/audio_format.h"
#include "rtc_base/ref_count.h" #include "api/ref_count.h"
namespace webrtc { namespace webrtc {
// A factory that creates AudioDecoders. // A factory that creates AudioDecoders.
class AudioDecoderFactory : public rtc::RefCountInterface { class AudioDecoderFactory : public RefCountInterface {
public: public:
virtual std::vector<AudioCodecSpec> GetSupportedDecoders() = 0; virtual std::vector<AudioCodecSpec> GetSupportedDecoders() = 0;

View file

@ -116,7 +116,7 @@ class DataChannelObserver {
virtual ~DataChannelObserver() = default; virtual ~DataChannelObserver() = default;
}; };
class RTC_EXPORT DataChannelInterface : public rtc::RefCountInterface { class RTC_EXPORT DataChannelInterface : public RefCountInterface {
public: public:
// C++ version of: https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelstate // C++ version of: https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelstate
// Unlikely to change, but keep in sync with DataChannel.java:State and // Unlikely to change, but keep in sync with DataChannel.java:State and

View file

@ -124,7 +124,7 @@ class RTC_EXPORT RTCStatsReport final
std::string ToJson() const; std::string ToJson() const;
protected: protected:
friend class rtc::RefCountedNonVirtual<RTCStatsReport>; friend class RefCountedNonVirtual<RTCStatsReport>;
~RTCStatsReport() = default; ~RTCStatsReport() = default;
private: private:

View file

@ -268,7 +268,7 @@ TEST_P(TaskQueueTest, PostALot) {
explicit BlockingCounter(int initial_count) : count_(initial_count) {} explicit BlockingCounter(int initial_count) : count_(initial_count) {}
void DecrementCount() { void DecrementCount() {
if (count_.DecRef() == rtc::RefCountReleaseStatus::kDroppedLastRef) { if (count_.DecRef() == webrtc::RefCountReleaseStatus::kDroppedLastRef) {
event_.Set(); event_.Set();
} }
} }

View file

@ -67,6 +67,7 @@ rtc_library("video_frame") {
":video_rtp_headers", ":video_rtp_headers",
"..:array_view", "..:array_view",
"..:make_ref_counted", "..:make_ref_counted",
"..:ref_count",
"..:rtp_packet_info", "..:rtp_packet_info",
"..:scoped_refptr", "..:scoped_refptr",
"..:video_track_source_constraints", "..:video_track_source_constraints",

View file

@ -14,8 +14,8 @@
#include <stdint.h> #include <stdint.h>
#include "api/array_view.h" #include "api/array_view.h"
#include "api/ref_count.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h" #include "rtc_base/system/rtc_export.h"
namespace webrtc { namespace webrtc {
@ -44,7 +44,7 @@ class NV12BufferInterface;
// performance by providing an optimized path without intermediate conversions. // performance by providing an optimized path without intermediate conversions.
// Frame metadata such as rotation and timestamp are stored in // Frame metadata such as rotation and timestamp are stored in
// webrtc::VideoFrame, and not here. // webrtc::VideoFrame, and not here.
class RTC_EXPORT VideoFrameBuffer : public rtc::RefCountInterface { class RTC_EXPORT VideoFrameBuffer : public webrtc::RefCountInterface {
public: public:
// New frame buffer types will be added conservatively when there is an // New frame buffer types will be added conservatively when there is an
// opportunity to optimize the path between some pair of video source and // opportunity to optimize the path between some pair of video source and

View file

@ -48,6 +48,7 @@ rtc_source_set("audio_device_api") {
"include/audio_device_defines.h", "include/audio_device_defines.h",
] ]
deps = [ deps = [
"../../api:ref_count",
"../../api:scoped_refptr", "../../api:scoped_refptr",
"../../api/task_queue", "../../api/task_queue",
"../../rtc_base:checks", "../../rtc_base:checks",

View file

@ -12,16 +12,16 @@
#define MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_H_ #define MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_H_
#include "absl/types/optional.h" #include "absl/types/optional.h"
#include "api/ref_count.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#include "api/task_queue/task_queue_factory.h" #include "api/task_queue/task_queue_factory.h"
#include "modules/audio_device/include/audio_device_defines.h" #include "modules/audio_device/include/audio_device_defines.h"
#include "rtc_base/ref_count.h"
namespace webrtc { namespace webrtc {
class AudioDeviceModuleForTest; class AudioDeviceModuleForTest;
class AudioDeviceModule : public rtc::RefCountInterface { class AudioDeviceModule : public webrtc::RefCountInterface {
public: public:
enum AudioLayer { enum AudioLayer {
kPlatformDefaultAudio = 0, kPlatformDefaultAudio = 0,

View file

@ -23,8 +23,8 @@ class FakeAudioDeviceModule
// references using scoped_refptr. Current code doesn't always use refcounting // references using scoped_refptr. Current code doesn't always use refcounting
// for this class. // for this class.
void AddRef() const override {} void AddRef() const override {}
rtc::RefCountReleaseStatus Release() const override { webrtc::RefCountReleaseStatus Release() const override {
return rtc::RefCountReleaseStatus::kDroppedLastRef; return webrtc::RefCountReleaseStatus::kDroppedLastRef;
} }
}; };

View file

@ -29,6 +29,7 @@ rtc_library("api") {
":audio_frame_view", ":audio_frame_view",
":audio_processing_statistics", ":audio_processing_statistics",
"../../api:array_view", "../../api:array_view",
"../../api:ref_count",
"../../api:scoped_refptr", "../../api:scoped_refptr",
"../../api/audio:aec3_config", "../../api/audio:aec3_config",
"../../api/audio:audio_frame_api", "../../api/audio:audio_frame_api",

View file

@ -48,7 +48,7 @@ class MockInitialize : public AudioProcessingImpl {
} }
MOCK_METHOD(void, AddRef, (), (const, override)); 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 // Creates MockEchoControl instances and provides a raw pointer access to

View file

@ -28,10 +28,10 @@
#include "api/array_view.h" #include "api/array_view.h"
#include "api/audio/echo_canceller3_config.h" #include "api/audio/echo_canceller3_config.h"
#include "api/audio/echo_control.h" #include "api/audio/echo_control.h"
#include "api/ref_count.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#include "modules/audio_processing/include/audio_processing_statistics.h" #include "modules/audio_processing/include/audio_processing_statistics.h"
#include "rtc_base/arraysize.h" #include "rtc_base/arraysize.h"
#include "rtc_base/ref_count.h"
#include "rtc_base/system/file_wrapper.h" #include "rtc_base/system/file_wrapper.h"
#include "rtc_base/system/rtc_export.h" #include "rtc_base/system/rtc_export.h"
@ -127,7 +127,7 @@ class CustomProcessing;
// // Close the application... // // Close the application...
// apm.reset(); // apm.reset();
// //
class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface { class RTC_EXPORT AudioProcessing : public RefCountInterface {
public: public:
// The struct below constitutes the new parameter scheme for the audio // The struct below constitutes the new parameter scheme for the audio
// processing. It is being introduced gradually and until it is fully // processing. It is being introduced gradually and until it is fully
@ -912,7 +912,7 @@ class CustomProcessing {
}; };
// Interface for an echo detector submodule. // Interface for an echo detector submodule.
class EchoDetector : public rtc::RefCountInterface { class EchoDetector : public RefCountInterface {
public: public:
// (Re-)Initializes the submodule. // (Re-)Initializes the submodule.
virtual void Initialize(int capture_sample_rate_hz, virtual void Initialize(int capture_sample_rate_hz,

View file

@ -18,7 +18,7 @@
namespace webrtc { namespace webrtc {
class VideoCaptureModule : public rtc::RefCountInterface { class VideoCaptureModule : public RefCountInterface {
public: public:
// Interface for receiving information about available camera devices. // Interface for receiving information about available camera devices.
class DeviceInfo { class DeviceInfo {

View file

@ -28,7 +28,7 @@ class MessageDeliverer {
} }
private: private:
struct State : public rtc::RefCountInterface { struct State : public webrtc::RefCountInterface {
explicit State(DcSctpMessage&& m) explicit State(DcSctpMessage&& m)
: has_delivered(false), message(std::move(m)) {} : has_delivered(false), message(std::move(m)) {}
bool has_delivered; bool has_delivered;

View file

@ -1971,6 +1971,7 @@ if (rtc_include_tests) {
":zero_memory", ":zero_memory",
"../api:array_view", "../api:array_view",
"../api:make_ref_counted", "../api:make_ref_counted",
"../api:ref_count",
"../api:scoped_refptr", "../api:scoped_refptr",
"../api/numerics", "../api/numerics",
"../api/units:data_rate", "../api/units:data_rate",

View file

@ -54,6 +54,7 @@ rtc_library("video_file_reader") {
] ]
deps = [ deps = [
"../api:make_ref_counted", "../api:make_ref_counted",
"../api:ref_count",
"../api:scoped_refptr", "../api:scoped_refptr",
"../api/video:video_frame", "../api/video:video_frame",
"../api/video:video_rtp_headers", "../api/video:video_rtp_headers",

View file

@ -16,16 +16,16 @@
#include <iterator> #include <iterator>
#include <string> #include <string>
#include "api/ref_count.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#include "api/video/video_frame_buffer.h" #include "api/video/video_frame_buffer.h"
#include "rtc_base/ref_count.h"
namespace webrtc { namespace webrtc {
namespace test { namespace test {
// Iterable class representing a sequence of I420 buffers. This class is not // Iterable class representing a sequence of I420 buffers. This class is not
// thread safe because it is expected to be backed by a file. // thread safe because it is expected to be backed by a file.
class Video : public rtc::RefCountInterface { class Video : public RefCountInterface {
public: public:
class Iterator { class Iterator {
public: public: