Index: include/core/SkChunkAlloc.h |
diff --git a/include/core/SkChunkAlloc.h b/include/core/SkChunkAlloc.h |
index e13e2b99c640368ebfbdc5f3e16f6e47f3620807..56e4f06a17949ce89ee04eeadcec094a354dc380 100644 |
--- a/include/core/SkChunkAlloc.h |
+++ b/include/core/SkChunkAlloc.h |
@@ -22,12 +22,22 @@ public: |
* pointers. |
*/ |
void reset(); |
+ /** |
+ * Free up all the blocks except the largest. This invalidates all |
+ * returned pointers. |
+ */ |
+ void rewind(); |
enum AllocFailType { |
kReturnNil_AllocFailType, |
kThrow_AllocFailType |
}; |
+ /** |
+ * Attempt to preallocate (but not mark as used) a block of memory |
+ */ |
+ void preAlloc(size_t bytes); |
+ |
void* alloc(size_t bytes, AllocFailType); |
void* allocThrow(size_t bytes) { |
return this->alloc(bytes, kThrow_AllocFailType); |
@@ -63,6 +73,8 @@ private: |
int fBlockCount; |
Block* newBlock(size_t bytes, AllocFailType ftype); |
+ Block* addBlockIfNecessary(size_t bytes, AllocFailType ftype); |
+ |
}; |
#endif |