Index: include/core/SkChunkAlloc.h |
diff --git a/include/core/SkChunkAlloc.h b/include/core/SkChunkAlloc.h |
index e13e2b99c640368ebfbdc5f3e16f6e47f3620807..9699842e6b42a7fab28c9ef8f27fb92fe54fc4d7 100644 |
--- a/include/core/SkChunkAlloc.h |
+++ b/include/core/SkChunkAlloc.h |
@@ -22,6 +22,11 @@ public: |
* pointers. |
*/ |
void reset(); |
+ /** |
+ * Reset to 0 used bytes preserving as much memory as possible. |
+ * This invalidates all returned pointers. |
+ */ |
+ void rewind(); |
enum AllocFailType { |
kReturnNil_AllocFailType, |
@@ -43,7 +48,8 @@ public: |
size_t totalCapacity() const { return fTotalCapacity; } |
size_t totalUsed() const { return fTotalUsed; } |
- int blockCount() const { return fBlockCount; } |
+ SkDEBUGCODE(int blockCount() const { return fBlockCount; }) |
+ SkDEBUGCODE(size_t totalLost() const { return fTotalLost; }) |
/** |
* Returns true if the specified address is within one of the chunks, and |
@@ -60,9 +66,13 @@ private: |
size_t fChunkSize; |
size_t fTotalCapacity; |
size_t fTotalUsed; // will be <= fTotalCapacity |
- int fBlockCount; |
+ SkDEBUGCODE(int fBlockCount;) |
+ SkDEBUGCODE(size_t fTotalLost;) // will be <= fTotalCapacity |
Block* newBlock(size_t bytes, AllocFailType ftype); |
+ Block* addBlockIfNecessary(size_t bytes, AllocFailType ftype); |
+ |
+ SkDEBUGCODE(void validate();) |
}; |
#endif |