Index: include/private/SkTemplates.h |
diff --git a/include/private/SkTemplates.h b/include/private/SkTemplates.h |
index 533cb264d163ee7354f1e53de7bac4a2de36cd61..c1fd4cbca62e681cdc8e3334ab9338631b7633bf 100644 |
--- a/include/private/SkTemplates.h |
+++ b/include/private/SkTemplates.h |
@@ -272,9 +272,10 @@ public: |
} |
/** Resize the memory area pointed to by the current ptr without preserving contents. */ |
- void reset(size_t count) { |
+ T* reset(size_t count) { |
sk_free(fPtr); |
fPtr = (T*)sk_malloc_flags(count * sizeof(T), SK_MALLOC_THROW); |
+ return fPtr; |
} |
T* get() const { return fPtr; } |
@@ -296,6 +297,13 @@ 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. |