| Index: include/core/SkRefCnt.h
|
| diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h
|
| index 1779278c6f889b920d81158266baaf970def088c..9d1e5f1f02c252c13c2091208903457403c0a825 100644
|
| --- a/include/core/SkRefCnt.h
|
| +++ b/include/core/SkRefCnt.h
|
| @@ -9,8 +9,8 @@
|
| #define SkRefCnt_DEFINED
|
|
|
| #include "../private/SkAtomics.h"
|
| +#include "../private/SkUniquePtr.h"
|
| #include "SkTypes.h"
|
| -#include <memory>
|
|
|
| /** \class SkRefCntBase
|
|
|
| @@ -185,22 +185,12 @@
|
| /**
|
| * Utility class that simply unref's its argument in the destructor.
|
| */
|
| -template <typename T> class SkAutoTUnref {
|
| -public:
|
| - explicit SkAutoTUnref(T* obj = nullptr) : fPtr(obj) {}
|
| -
|
| - void swap(SkAutoTUnref& other) { fPtr.swap(other.fPtr); }
|
| -
|
| - T* get() const { return fPtr.get(); }
|
| - operator T* () const { return fPtr.get(); }
|
| - T* operator->() const { return fPtr.get(); }
|
| -
|
| - void reset(T* ptr = nullptr) { fPtr.reset(ptr); }
|
| - T* detach() { return fPtr.release(); }
|
| - T* release() { return fPtr.release(); }
|
| -
|
| -private:
|
| - std::unique_ptr<T, SkTUnref<T>> fPtr;
|
| +template <typename T> class SkAutoTUnref : public skstd::unique_ptr<T, SkTUnref<T>> {
|
| +public:
|
| + explicit SkAutoTUnref(T* obj = nullptr) : skstd::unique_ptr<T, SkTUnref<T>>(obj) {}
|
| +
|
| + T* detach() { return this->release(); }
|
| + operator T*() const { return this->get(); }
|
| };
|
| // Can't use the #define trick below to guard a bare SkAutoTUnref(...) because it's templated. :(
|
|
|
|
|