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

Unified Diff: src/core/SkVarAlloc.cpp

Issue 793033002: SkRecord: increase min block to 512B, remove max. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: bump Gr Created 6 years 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 | « src/core/SkVarAlloc.h ('k') | src/gpu/GrFontCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkVarAlloc.cpp
diff --git a/src/core/SkVarAlloc.cpp b/src/core/SkVarAlloc.cpp
index 8f84b95743e5ba54d80b39ec34c0c7c2b4f1c502..ba5d6f50b05a12e83aec99bed1a7ff636c299948 100644
--- a/src/core/SkVarAlloc.cpp
+++ b/src/core/SkVarAlloc.cpp
@@ -7,11 +7,6 @@
#include <malloc.h>
#endif
-enum {
- kMinLgSize = 4, // The smallest block we'd ever want to allocate is 16B,
- kMaxLgSize = 16, // and we see no benefit allocating blocks larger than 64K.
-};
-
struct SkVarAlloc::Block {
Block* prev;
char* data() { return (char*)(this + 1); }
@@ -24,10 +19,10 @@ struct SkVarAlloc::Block {
}
};
-SkVarAlloc::SkVarAlloc()
+SkVarAlloc::SkVarAlloc(size_t minLgSize)
: fByte(NULL)
, fRemaining(0)
- , fLgSize(kMinLgSize)
+ , fLgSize(minLgSize)
, fBlock(NULL) {}
SkVarAlloc::~SkVarAlloc() {
@@ -42,7 +37,7 @@ SkVarAlloc::~SkVarAlloc() {
void SkVarAlloc::makeSpace(size_t bytes, unsigned flags) {
SkASSERT(SkIsAlignPtr(bytes));
- size_t alloc = 1<<fLgSize;
+ size_t alloc = 1<<fLgSize++;
while (alloc < bytes + sizeof(Block)) {
alloc *= 2;
}
@@ -50,10 +45,6 @@ void SkVarAlloc::makeSpace(size_t bytes, unsigned flags) {
fByte = fBlock->data();
fRemaining = alloc - sizeof(Block);
- if (fLgSize < kMaxLgSize) {
- fLgSize++;
- }
-
#if defined(SK_BUILD_FOR_MAC)
SkASSERT(alloc == malloc_good_size(alloc));
#elif defined(SK_BUILD_FOR_UNIX)
« no previous file with comments | « src/core/SkVarAlloc.h ('k') | src/gpu/GrFontCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698