diff options
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkData.h | 35 | ||||
-rw-r--r-- | include/core/SkRefCnt.h | 5 |
2 files changed, 5 insertions, 35 deletions
diff --git a/include/core/SkData.h b/include/core/SkData.h index 06edb020d8..fdd3a57efe 100644 --- a/include/core/SkData.h +++ b/include/core/SkData.h @@ -122,41 +122,10 @@ private: SkData(const void* ptr, size_t size, ReleaseProc, void* context); virtual ~SkData(); - // This is here because SkAutoTUnref creates an internal helper class - // that derives from SkData (i.e., BlockRef) to prevent refs\unrefs. - // This helper class generates a compiler warning on Windows since the - // SkData's destructor is private. This friending gives the helper class - // access to the destructor. - friend class SkAutoTUnref<SkData>::BlockRef<SkData>; - typedef SkFlattenable INHERITED; }; -/** - * Specialized version of SkAutoTUnref<SkData> for automatically unref-ing a - * SkData. - */ -class SkAutoDataUnref : SkNoncopyable { -public: - SkAutoDataUnref(SkData* data) : fRef(data) {} - ~SkAutoDataUnref() { - SkSafeUnref(fRef); - } - - SkData* get() const { return fRef; } - - void release() { - if (fRef) { - fRef->unref(); - fRef = NULL; - } - } - - SkData *operator->() const { return fRef; } - operator SkData*() { return fRef; } - -private: - SkData* fRef; -}; +/** Typedef of SkAutoTUnref<SkData> for automatically unref-ing a SkData. */ +typedef SkAutoTUnref<SkData> SkAutoDataUnref; #endif diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h index 66fc9dba68..c20ef24069 100644 --- a/include/core/SkRefCnt.h +++ b/include/core/SkRefCnt.h @@ -189,12 +189,13 @@ public: } /** - * BlockRef<B> is a type which inherits from B, cannot be created, - * and makes ref and unref private. + * BlockRef<B> is a type which inherits from B, cannot be created, + * cannot be deleted, and makes ref and unref private. */ template<typename B> class BlockRef : public B { private: BlockRef(); + ~BlockRef(); void ref() const; void unref() const; }; |