Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(610)

Unified Diff: webrtc/base/refcount.h

Issue 2425683003: Change RefCountedObject to use perfect forwarding. (Closed)
Patch Set: git cl lint + screen_capturer_differ_wrapper.cc Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/BUILD.gn ('k') | webrtc/base/refcountedobject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/refcount.h
diff --git a/webrtc/base/refcount.h b/webrtc/base/refcount.h
index 9e881c85bd811b5a32b34be7525ae3f6950cd66c..565ae495b2772012212c91bb04d054b5424802ab 100644
--- a/webrtc/base/refcount.h
+++ b/webrtc/base/refcount.h
@@ -7,14 +7,10 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-
#ifndef WEBRTC_BASE_REFCOUNT_H_
#define WEBRTC_BASE_REFCOUNT_H_
-#include <string.h>
-#include <utility>
-
-#include "webrtc/base/atomicops.h"
+#include "webrtc/base/refcountedobject.h"
namespace rtc {
@@ -28,151 +24,6 @@ class RefCountInterface {
virtual ~RefCountInterface() {}
};
-template <class T>
-class RefCountedObject : public T {
- public:
- RefCountedObject() {}
-
- template <typename P>
- explicit RefCountedObject(const P& p) : T(p) {}
-
- template <typename P>
- explicit RefCountedObject(P&& p) : T(std::move(p)) {}
-
- template <typename P1, typename P2>
- RefCountedObject(P1 p1, P2 p2) : T(p1, p2) {}
-
- template <typename P1, typename P2, typename P3>
- RefCountedObject(P1 p1, P2 p2, P3 p3) : T(p1, p2, p3) {}
-
- template <typename P1, typename P2, typename P3, typename P4>
- RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4) : T(p1, p2, p3, p4) {}
-
- template <typename P1, typename P2, typename P3, typename P4, typename P5>
- RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) : T(p1, p2, p3, p4, p5) {}
-
- template <typename P1,
- typename P2,
- typename P3,
- typename P4,
- typename P5,
- typename P6>
- RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
- : T(p1, p2, p3, p4, p5, p6) {}
-
- template <typename P1,
- typename P2,
- typename P3,
- typename P4,
- typename P5,
- typename P6,
- typename P7>
- RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
- : T(p1, p2, p3, p4, p5, p6, p7) {}
-
- template <typename P1,
- typename P2,
- typename P3,
- typename P4,
- typename P5,
- typename P6,
- typename P7,
- typename P8>
- RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
- : T(p1, p2, p3, p4, p5, p6, p7, p8) {}
-
- template <typename P1,
- typename P2,
- typename P3,
- typename P4,
- typename P5,
- typename P6,
- typename P7,
- typename P8,
- typename P9>
- RefCountedObject(P1 p1,
- P2 p2,
- P3 p3,
- P4 p4,
- P5 p5,
- P6 p6,
- P7 p7,
- P8 p8,
- P9 p9)
- : T(p1, p2, p3, p4, p5, p6, p7, p8, p9) {}
-
- template <typename P1,
- typename P2,
- typename P3,
- typename P4,
- typename P5,
- typename P6,
- typename P7,
- typename P8,
- typename P9,
- typename P10>
- RefCountedObject(P1 p1,
- P2 p2,
- P3 p3,
- P4 p4,
- P5 p5,
- P6 p6,
- P7 p7,
- P8 p8,
- P9 p9,
- P10 p10)
- : T(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) {}
-
- template <typename P1,
- typename P2,
- typename P3,
- typename P4,
- typename P5,
- typename P6,
- typename P7,
- typename P8,
- typename P9,
- typename P10,
- typename P11>
- RefCountedObject(P1 p1,
- P2 p2,
- P3 p3,
- P4 p4,
- P5 p5,
- P6 p6,
- P7 p7,
- P8 p8,
- P9 p9,
- P10 p10,
- P11 p11)
- : T(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) {}
-
- virtual int AddRef() const { return AtomicOps::Increment(&ref_count_); }
-
- virtual int Release() const {
- int count = AtomicOps::Decrement(&ref_count_);
- if (!count) {
- delete this;
- }
- return count;
- }
-
- // Return whether the reference count is one. If the reference count is used
- // in the conventional way, a reference count of 1 implies that the current
- // thread owns the reference and no other thread shares it. This call
- // performs the test for a reference count of one, and performs the memory
- // barrier needed for the owning thread to act on the object, knowing that it
- // has exclusive access to the object.
- virtual bool HasOneRef() const {
- return AtomicOps::AcquireLoad(&ref_count_) == 1;
- }
-
- protected:
- virtual ~RefCountedObject() {}
-
- mutable volatile int ref_count_ = 0;
-};
-
} // namespace rtc
#endif // WEBRTC_BASE_REFCOUNT_H_
« no previous file with comments | « webrtc/base/BUILD.gn ('k') | webrtc/base/refcountedobject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698