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

Unified Diff: Source/wtf/PartitionAlloc.cpp

Issue 1053793004: Add a UseCounter that measures the amount of memory used in PartitionAlloc (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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
Index: Source/wtf/PartitionAlloc.cpp
diff --git a/Source/wtf/PartitionAlloc.cpp b/Source/wtf/PartitionAlloc.cpp
index 43fd01be3a08a82bcb8924c492edd71c1eff0245..6f3a19add76976fa988506d86aff3e4488bd7bb7 100644
--- a/Source/wtf/PartitionAlloc.cpp
+++ b/Source/wtf/PartitionAlloc.cpp
@@ -30,6 +30,7 @@
#include "config.h"
#include "wtf/PartitionAlloc.h"
+#include "wtf/Partitions.h"
Chris Evans 2015/04/02 15:53:01 Hmm -- this introduces a circular dependency. Not
haraken 2015/04/02 23:31:31 Done.
#include <string.h>
@@ -356,6 +357,7 @@ static ALWAYS_INLINE void* partitionAllocPartitionPages(PartitionRootBase* root,
root->nextPartitionPage += totalSize;
root->totalSizeOfCommittedPages += totalSize;
ASSERT(root->totalSizeOfCommittedPages <= root->totalSizeOfSuperPages + root->totalSizeOfDirectMappedPages);
+ Partitions::recordMemoryUsageIfNeeded();
Chris Evans 2015/04/02 15:53:01 To reduce minor code duplication, can we pull both
haraken 2015/04/02 23:31:32 Done.
return ret;
}
@@ -370,6 +372,7 @@ static ALWAYS_INLINE void* partitionAllocPartitionPages(PartitionRootBase* root,
root->totalSizeOfSuperPages += kSuperPageSize;
root->totalSizeOfCommittedPages += totalSize;
ASSERT(root->totalSizeOfCommittedPages <= root->totalSizeOfSuperPages + root->totalSizeOfDirectMappedPages);
+ Partitions::recordMemoryUsageIfNeeded();
root->nextSuperPage = superPage + kSuperPageSize;
char* ret = superPage + kPartitionPageSize;
@@ -615,6 +618,7 @@ static ALWAYS_INLINE void* partitionDirectMap(PartitionRootBase* root, int flags
root->totalSizeOfCommittedPages += committedPageSize;
root->totalSizeOfDirectMappedPages += committedPageSize;
ASSERT(root->totalSizeOfCommittedPages <= root->totalSizeOfSuperPages + root->totalSizeOfDirectMappedPages);
+ Partitions::recordMemoryUsageIfNeeded();
Chris Evans 2015/04/02 15:53:01 For consistency, we should probably call the callb
haraken 2015/04/02 23:31:31 Done. Actually we don't need to report memory usag
// TODO: we may want to let the operating system place these allocations
// where it pleases. On 32-bit, this might limit address space

Powered by Google App Engine
This is Rietveld 408576698