Index: include/core/SkTemplates.h |
diff --git a/include/core/SkTemplates.h b/include/core/SkTemplates.h |
index 5d3fa2d10cd2371c7dcebf2b45552e8922412884..434fcb8c0ea1111a748bfb59edd18aa6e317cce0 100644 |
--- a/include/core/SkTemplates.h |
+++ b/include/core/SkTemplates.h |
@@ -77,7 +77,19 @@ template <typename T, void (*P)(T*)> class SkAutoTCallVProc : SkNoncopyable { |
public: |
SkAutoTCallVProc(T* obj): fObj(obj) {} |
~SkAutoTCallVProc() { if (fObj) P(fObj); } |
+ |
+ operator T*() const { return fObj; } |
+ T* operator->() const { SkASSERT(fObj); return fObj; } |
+ |
T* detach() { T* obj = fObj; fObj = NULL; return obj; } |
+ void reset(T* obj = NULL) { |
+ if (fObj != obj) { |
+ if (fObj) { |
+ P(fObj); |
+ } |
+ fObj = obj; |
+ } |
+ } |
private: |
T* fObj; |
}; |