aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2018-06-14 14:39:33 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-14 19:14:04 +0000
commite08ce40f4a569c692f6b3b74f3ba39ac1eddf269 (patch)
tree33cd0476f688edf5c8b9d02d730c685f9fe45845 /include/core
parente39bc9fd4310a3bc19ccbc24c9471977bbf536f1 (diff)
SkRefCnt no longer a SkNoncopyable
Change-Id: I345c83783c578f5ce25b4fc46c971c055e113cd0 Reviewed-on: https://skia-review.googlesource.com/134945 Auto-Submit: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com> Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkRefCnt.h14
1 files changed, 10 insertions, 4 deletions
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<int32_t> fRefCnt;
-
- typedef SkNoncopyable INHERITED;
};
#ifdef SK_REF_CNT_MIXIN_INCLUDE
@@ -207,10 +209,14 @@ template<typename T> 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 <typename Derived>
-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;