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

Unified Diff: src/core/SkVarAlloc.cpp

Issue 722293003: Cap SkVarAlloc's desired block at 64K. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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
« src/core/SkVarAlloc.h ('K') | « src/core/SkVarAlloc.h ('k') | no next file » | 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 cc1fc1c734113072e9d57f93e75b8c110a626d81..4c570cd9294451e19d2758a57b95999ffb32ae5f 100644
--- a/src/core/SkVarAlloc.cpp
+++ b/src/core/SkVarAlloc.cpp
@@ -37,7 +37,7 @@ SkVarAlloc::~SkVarAlloc() {
void SkVarAlloc::makeSpace(size_t bytes, unsigned flags) {
SkASSERT(SkIsAlignPtr(bytes));
- size_t alloc = 1<<(fLgMinSize++);
+ size_t alloc = 1<<fLgMinSize;
while (alloc < bytes + sizeof(Block)) {
alloc *= 2;
}
@@ -45,6 +45,10 @@ void SkVarAlloc::makeSpace(size_t bytes, unsigned flags) {
fByte = fBlock->data();
fRemaining = alloc - sizeof(Block);
+ if (fLgMinSize < 16) {
reed1 2014/11/13 21:40:07 please add comment + possible a #define with a com
+ fLgMinSize++;
+ }
+
#if defined(SK_BUILD_FOR_MAC)
SkASSERT(alloc == malloc_good_size(alloc));
#elif defined(SK_BUILD_FOR_LINUX)
« src/core/SkVarAlloc.h ('K') | « src/core/SkVarAlloc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698