Chromium Code Reviews| Index: Source/platform/heap/Heap.cpp |
| diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp |
| index c938b3a3ffe05e998fc64b37b3048150329650cc..3b5575e96dbc6dc2cf7708fa1c22568d6c16a1ad 100644 |
| --- a/Source/platform/heap/Heap.cpp |
| +++ b/Source/platform/heap/Heap.cpp |
| @@ -41,6 +41,8 @@ |
| #include "platform/heap/SafePoint.h" |
| #include "platform/heap/ThreadState.h" |
| #include "public/platform/Platform.h" |
| +#include "public/platform/WebMemoryAllocatorDump.h" |
| +#include "public/platform/WebProcessMemoryDump.h" |
| #include "wtf/Assertions.h" |
| #include "wtf/ContainerAnnotations.h" |
| #include "wtf/LeakAnnotations.h" |
| @@ -213,6 +215,21 @@ void BaseHeap::cleanupPages() |
| m_firstPage = nullptr; |
| } |
| +void BaseHeap::dumpMemoryInto(WebProcessMemoryDump* memoryDump, const char* heapName) |
| +{ |
| + String dumpName; |
| + if (threadState()->isMainThread()) { |
| + dumpName = String::format("blink_gc/thread_main/heaps/%s", heapName); |
| + } else { |
| + dumpName = String::format("blink_gc/thread_%ld/heaps/%s", currentThread(), heapName); |
| + } |
| + WebMemoryAllocatorDump* allocatorDump = memoryDump->createMemoryAllocatorDump(dumpName); |
| + |
| + size_t pageCount = 0; |
| + for (BasePage* page = m_firstPage; page; page = page->next(), ++pageCount) { } |
|
petrcermak
2015/05/21 13:15:57
I would personally put the increment in the body o
picksi
2015/05/21 15:33:49
+1
ssid
2015/05/21 16:55:28
Done.
|
| + allocatorDump->AddScalar("blink_page_count", "objects", pageCount); |
|
petrcermak
2015/05/21 13:15:57
The only alternative I can think of is "base_page_
ssid
2015/05/21 16:55:28
Acknowledged.
|
| +} |
| + |
| #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| BasePage* BaseHeap::findPageFromAddress(Address address) |
| { |