 Chromium Code Reviews
 Chromium Code Reviews Issue 14081016:
  Remove static effects from the effect memory pool.  (Closed) 
  Base URL: http://skia.googlecode.com/svn/trunk/
    
  
    Issue 14081016:
  Remove static effects from the effect memory pool.  (Closed) 
  Base URL: http://skia.googlecode.com/svn/trunk/| Index: include/core/SkTemplates.h | 
| =================================================================== | 
| --- include/core/SkTemplates.h (revision 8808) | 
| +++ include/core/SkTemplates.h (working copy) | 
| @@ -119,6 +119,24 @@ | 
| T* fObj; | 
| }; | 
| +// Calls ~T() in the destructor. | 
| +template <typename T> class SkAutoTDestroy : SkNoncopyable { | 
| +public: | 
| + SkAutoTDestroy(T* obj = NULL) : fObj(obj) {} | 
| + ~SkAutoTDestroy() { | 
| 
robertphillips
2013/04/22 22:05:13
NULL !=
 | 
| + if (fObj) { | 
| + fObj->~T(); | 
| + } | 
| + } | 
| + | 
| + T* get() const { return fObj; } | 
| + T& operator*() const { SkASSERT(fObj); return *fObj; } | 
| + T* operator->() const { SkASSERT(fObj); return fObj; } | 
| + | 
| +private: | 
| + T* fObj; | 
| +}; | 
| + | 
| template <typename T> class SkAutoTDeleteArray : SkNoncopyable { | 
| public: | 
| SkAutoTDeleteArray(T array[]) : fArray(array) {} |