Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Unified Diff: src/gpu/GrMemoryPool.h

Issue 742253002: remove GrAllocPool (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to use SkVarAlloc Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « src/gpu/GrAllocPool.cpp ('k') | src/gpu/GrMemoryPool.cpp » ('j') | src/gpu/GrTextStrike.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698