Chromium Code Reviews| Index: include/core/SkTemplates.h |
| diff --git a/include/core/SkTemplates.h b/include/core/SkTemplates.h |
| index 76254e00ee2ac710b8ad63f260ac82274db99b80..a3a846600a9e9d84f0bea176fa209b657815f258 100644 |
| --- a/include/core/SkTemplates.h |
| +++ b/include/core/SkTemplates.h |
| @@ -178,6 +178,13 @@ public: |
| void free() { SkDELETE_ARRAY(fArray); fArray = NULL; } |
| T* detach() { T* array = fArray; fArray = NULL; return array; } |
| + void reset(T array[]) { |
| + if (fArray != array) { |
| + SkDELETE_ARRAY(fArray); |
|
robertphillips
2014/01/31 00:23:13
Move the assignment outside of the if block?
|
| + fArray = array; |
| + } |
| + } |
| + |
| private: |
| T* fArray; |
| }; |