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

Unified Diff: src/core/SkVarAlloc.cpp

Issue 741443002: Revert of SkVarAlloc::approxBytesAllocated (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
« no previous file with comments | « src/core/SkVarAlloc.h ('k') | tests/VarAllocTest.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..6f5b5a18d3a16427a9d6c7b49bfb1bbfa1f53b24 100644
--- a/src/core/SkVarAlloc.cpp
+++ b/src/core/SkVarAlloc.cpp
@@ -3,7 +3,7 @@
// We use non-standard malloc diagnostic methods to make sure our allocations are sized well.
#if defined(SK_BUILD_FOR_MAC)
#include <malloc/malloc.h>
-#elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN32)
+#elif defined(SK_BUILD_FOR_LINUX)
#include <malloc.h>
#endif
@@ -56,28 +56,7 @@
#if defined(SK_BUILD_FOR_MAC)
SkASSERT(alloc == malloc_good_size(alloc));
-#elif defined(SK_BUILD_FOR_UNIX)
- // TODO(mtklein): tune so we can assert something like this
- //SkASSERT(alloc == malloc_usable_size(fBlock));
+#elif defined(SK_BUILD_FOR_LINUX)
+ SkASSERT(alloc == malloc_usable_size(fByte - sizeof(Block)));
#endif
}
-
-static size_t heap_size(void* p) {
-#if defined(SK_BUILD_FOR_MAC)
- return malloc_size(p);
-#elif defined(SK_BUILD_FOR_UNIX)
- return malloc_usable_size(p);
-#elif defined(SK_BUILD_FOR_WIN32)
- return _msize(p);
-#else
- return 0; // Tough luck.
-#endif
-}
-
-size_t SkVarAlloc::approxBytesAllocated() const {
- size_t sum = 0;
- for (Block* b = fBlock; b; b = b->prev) {
- sum += heap_size(b);
- }
- return sum;
-}
« no previous file with comments | « src/core/SkVarAlloc.h ('k') | tests/VarAllocTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698