Index: src/gpu/GrMemoryPool.h |
diff --git a/src/gpu/GrMemoryPool.h b/src/gpu/GrMemoryPool.h |
index 5ab8958a8a2539ddb16783fbc806c259c66d8a6b..5f8af7db217774e89b84bba8f10722f13549bec9 100644 |
--- a/src/gpu/GrMemoryPool.h |
+++ b/src/gpu/GrMemoryPool.h |
@@ -38,6 +38,8 @@ public: |
*/ |
void release(void* p); |
+ void releaseAll(); |
+ |
/** |
* Returns true if there are no unreleased allocations. |
*/ |
@@ -77,4 +79,16 @@ private: |
#endif |
}; |
+template <typename T> class GrTMemoryPool { |
+public: |
+ GrTMemoryPool(size_t count) |
+ : fPool(count * sizeof(T), count * sizeof(T)) {} |
+ |
+ T* allocate() { return (T*)fPool.allocate(sizeof(T)); } |
+ void releaseAll() { fPool.releaseAll(); } |
+ |
+private: |
+ GrMemoryPool fPool; |
+}; |
+ |
#endif |