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

Unified Diff: src/core/SkVarAlloc.h

Issue 1090943004: O(1) SkPictureUtils::ApproxBytesUsed() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: const Created 5 years, 8 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 | « src/core/SkRecorder.cpp ('k') | src/core/SkVarAlloc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkVarAlloc.h
diff --git a/src/core/SkVarAlloc.h b/src/core/SkVarAlloc.h
index 8a55b366155fdfafdd598511a374876ffd565d24..e8236cf9920067864a0261a09a1e70aa3b536dc6 100644
--- a/src/core/SkVarAlloc.h
+++ b/src/core/SkVarAlloc.h
@@ -35,12 +35,14 @@ public:
}
// Returns our best estimate of the number of bytes we've allocated.
- // (We intentionally do not track this precisely to save space.)
- size_t approxBytesAllocated() const;
+ // (We may not track this precisely to save space.)
+ size_t approxBytesAllocated() const { return fBytesAllocated; }
private:
void makeSpace(size_t bytes, unsigned flags);
+ size_t fBytesAllocated;
+
char* fByte;
unsigned fRemaining;
unsigned fLgSize;
@@ -48,6 +50,6 @@ private:
struct Block;
Block* fBlock;
};
-SK_COMPILE_ASSERT(sizeof(SkVarAlloc) <= 24, SkVarAllocSize);
+SK_COMPILE_ASSERT(sizeof(SkVarAlloc) <= 32, SkVarAllocSize);
#endif//SkVarAlloc_DEFINED
« no previous file with comments | « src/core/SkRecorder.cpp ('k') | src/core/SkVarAlloc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698