Index: include/private/SkTemplates.h |
diff --git a/include/private/SkTemplates.h b/include/private/SkTemplates.h |
index 526c307558c6a98db262d54ef37bc5548af69f14..8850a29a63653798d03af5313fb6622bdba34820 100644 |
--- a/include/private/SkTemplates.h |
+++ b/include/private/SkTemplates.h |
@@ -96,7 +96,6 @@ public: |
SkAutoTDelete(T* obj = NULL) : std::unique_ptr<T>(obj) {} |
operator T*() const { return this->get(); } |
- void free() { this->reset(nullptr); } |
// See SkAutoTUnref for why we do this. |
explicit operator bool() const { return this->get() != nullptr; } |
@@ -105,8 +104,6 @@ public: |
template <typename T> class SkAutoTDeleteArray : public std::unique_ptr<T[]> { |
public: |
SkAutoTDeleteArray(T array[]) : std::unique_ptr<T[]>(array) {} |
- |
- void free() { this->reset(nullptr); } |
}; |
/** Allocate an array of T elements, and free the array in the destructor |
@@ -281,9 +278,9 @@ public: |
} |
/** Resize the memory area pointed to by the current ptr without preserving contents. */ |
- T* reset(size_t count) { |
+ T* reset(size_t count = 0) { |
sk_free(fPtr); |
- fPtr = (T*)sk_malloc_flags(count * sizeof(T), SK_MALLOC_THROW); |
+ fPtr = count ? (T*)sk_malloc_flags(count * sizeof(T), SK_MALLOC_THROW) : nullptr; |
return fPtr; |
} |
@@ -306,13 +303,6 @@ public: |
} |
/** |
- * Releases the block back to the heap |
- */ |
- void free() { |
- this->reset(0); |
- } |
- |
- /** |
* Transfer ownership of the ptr to the caller, setting the internal |
* pointer to NULL. Note that this differs from get(), which also returns |
* the pointer, but it does not transfer ownership. |