diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/libwebrtc/rtc_base/ref_count.h | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/rtc_base/ref_count.h')
-rw-r--r-- | third_party/libwebrtc/rtc_base/ref_count.h | 55 |
1 files changed, 7 insertions, 48 deletions
diff --git a/third_party/libwebrtc/rtc_base/ref_count.h b/third_party/libwebrtc/rtc_base/ref_count.h index d8d652abd8..60a11fa5c7 100644 --- a/third_party/libwebrtc/rtc_base/ref_count.h +++ b/third_party/libwebrtc/rtc_base/ref_count.h @@ -10,57 +10,16 @@ #ifndef RTC_BASE_REF_COUNT_H_ #define RTC_BASE_REF_COUNT_H_ -namespace rtc { - -// Refcounted objects should implement the following informal interface: -// -// void AddRef() const ; -// RefCountReleaseStatus Release() const; -// -// You may access members of a reference-counted object, including the AddRef() -// and Release() methods, only if you already own a reference to it, or if -// you're borrowing someone else's reference. (A newly created object is a -// special case: the reference count is zero on construction, and the code that -// creates the object should immediately call AddRef(), bringing the reference -// count from zero to one, e.g., by constructing an rtc::scoped_refptr). -// -// AddRef() creates a new reference to the object. -// -// Release() releases a reference to the object; the caller now has one less -// reference than before the call. Returns kDroppedLastRef if the number of -// references dropped to zero because of this (in which case the object destroys -// itself). Otherwise, returns kOtherRefsRemained, to signal that at the precise -// time the caller's reference was dropped, other references still remained (but -// if other threads own references, this may of course have changed by the time -// Release() returns). -// -// The caller of Release() must treat it in the same way as a delete operation: -// Regardless of the return value from Release(), the caller mustn't access the -// object. The object might still be alive, due to references held by other -// users of the object, but the object can go away at any time, e.g., as the -// result of another thread calling Release(). -// -// Calling AddRef() and Release() manually is discouraged. It's recommended to -// use rtc::scoped_refptr to manage all pointers to reference counted objects. -// Note that rtc::scoped_refptr depends on compile-time duck-typing; formally -// implementing the below RefCountInterface is not required. +// Transition file for backwards compatibility with source code +// that includes the non-API file. -enum class RefCountReleaseStatus { kDroppedLastRef, kOtherRefsRemained }; +#include "api/ref_count.h" -// Interfaces where refcounting is part of the public api should -// inherit this abstract interface. The implementation of these -// methods is usually provided by the RefCountedObject template class, -// applied as a leaf in the inheritance tree. -class RefCountInterface { - public: - virtual void AddRef() const = 0; - virtual RefCountReleaseStatus Release() const = 0; +namespace rtc { - // Non-public destructor, because Release() has exclusive responsibility for - // destroying the object. - protected: - virtual ~RefCountInterface() {} -}; +// TODO(bugs.webrtc.org/15622): Deprecate and remove these aliases. +using webrtc::RefCountInterface; +using webrtc::RefCountReleaseStatus; } // namespace rtc |