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

Unified Diff: include/core/SkChunkAlloc.h

Issue 940533003: Decrease GrInOrderDrawBuffer::Cmd's reliance on GrInOrderDrawBuffer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bug and add unit test Created 5 years, 10 months 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
« no previous file with comments | « no previous file | src/core/SkChunkAlloc.cpp » ('j') | src/gpu/GrInOrderDrawBuffer.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | src/core/SkChunkAlloc.cpp » ('j') | src/gpu/GrInOrderDrawBuffer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698