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

Unified Diff: src/core/SkChunkAlloc.cpp

Issue 17449012: combine glyph and image bulk alloc, and adjust initial alloc size, to reduce total waste from 50% t… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 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 | « include/core/SkChunkAlloc.h ('k') | src/core/SkGlyphCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkChunkAlloc.cpp
diff --git a/src/core/SkChunkAlloc.cpp b/src/core/SkChunkAlloc.cpp
index 30cc4e19a7c363f2ba67f47290b5b2fc46cbf9af..8251eae6621151f7cae1de0653b1aab68a1f059f 100644
--- a/src/core/SkChunkAlloc.cpp
+++ b/src/core/SkChunkAlloc.cpp
@@ -52,6 +52,7 @@ SkChunkAlloc::SkChunkAlloc(size_t minSize) {
fMinSize = minSize;
fChunkSize = fMinSize;
fTotalCapacity = 0;
+ fTotalUsed = 0;
fBlockCount = 0;
}
@@ -64,6 +65,7 @@ void SkChunkAlloc::reset() {
fBlock = NULL;
fChunkSize = fMinSize; // reset to our initial minSize
fTotalCapacity = 0;
+ fTotalUsed = 0;
fBlockCount = 0;
}
@@ -90,6 +92,8 @@ SkChunkAlloc::Block* SkChunkAlloc::newBlock(size_t bytes, AllocFailType ftype) {
}
void* SkChunkAlloc::alloc(size_t bytes, AllocFailType ftype) {
+ fTotalUsed += bytes;
+
bytes = SkAlign4(bytes);
Block* block = fBlock;
« no previous file with comments | « include/core/SkChunkAlloc.h ('k') | src/core/SkGlyphCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698