From e08ce40f4a569c692f6b3b74f3ba39ac1eddf269 Mon Sep 17 00:00:00 2001 From: Hal Canary Date: Thu, 14 Jun 2018 14:39:33 -0400 Subject: SkRefCnt no longer a SkNoncopyable Change-Id: I345c83783c578f5ce25b4fc46c971c055e113cd0 Reviewed-on: https://skia-review.googlesource.com/134945 Auto-Submit: Hal Canary Commit-Queue: Hal Canary Commit-Queue: Mike Klein Reviewed-by: Mike Klein --- include/core/SkRefCnt.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'include/core/SkRefCnt.h') diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h index eebc9684de..aa7a0f0c0e 100644 --- a/include/core/SkRefCnt.h +++ b/include/core/SkRefCnt.h @@ -27,11 +27,15 @@ destructor to be called explicitly (or via the object going out of scope on the stack or calling delete) if getRefCnt() > 1. */ -class SK_API SkRefCntBase : SkNoncopyable { +class SK_API SkRefCntBase { public: /** Default construct, initializing the reference count to 1. */ SkRefCntBase() : fRefCnt(1) {} + SkRefCntBase(SkRefCntBase&&) = delete; + SkRefCntBase(const SkRefCntBase&) = delete; + SkRefCntBase& operator=(SkRefCntBase&&) = delete; + SkRefCntBase& operator=(const SkRefCntBase&) = delete; /** Destruct, asserting that the reference count is 1. */ @@ -114,8 +118,6 @@ private: friend class SkWeakRefCnt; mutable std::atomic fRefCnt; - - typedef SkNoncopyable INHERITED; }; #ifdef SK_REF_CNT_MIXIN_INCLUDE @@ -207,10 +209,14 @@ template static inline void SkSafeSetNull(T*& obj) { // This is a variant of SkRefCnt that's Not Virtual, so weighs 4 bytes instead of 8 or 16. // There's only benefit to using this if the deriving class does not otherwise need a vtable. template -class SkNVRefCnt : SkNoncopyable { +class SkNVRefCnt { public: SkNVRefCnt() : fRefCnt(1) {} ~SkNVRefCnt() { SkASSERTF(1 == getRefCnt(), "NVRefCnt was %d", getRefCnt()); } + SkNVRefCnt(SkNVRefCnt&&) = delete; + SkNVRefCnt(const SkNVRefCnt&) = delete; + SkNVRefCnt& operator=(SkNVRefCnt&&) = delete; + SkNVRefCnt& operator=(const SkNVRefCnt&) = delete; // Implementation is pretty much the same as SkRefCntBase. All required barriers are the same: // - unique() needs acquire when it returns true, and no barrier if it returns false; -- cgit v1.2.3