Index: third_party/WebKit/Source/platform/heap/HeapPage.cpp |
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.cpp b/third_party/WebKit/Source/platform/heap/HeapPage.cpp |
index e9dcbe158cc2575f8f7b60b7ee480973c5e0c325..d3be9f309502846982e4c39ecf5ccc6481fe31f2 100644 |
--- a/third_party/WebKit/Source/platform/heap/HeapPage.cpp |
+++ b/third_party/WebKit/Source/platform/heap/HeapPage.cpp |
@@ -136,25 +136,22 @@ void BaseHeap::takeSnapshot(const String& dumpBaseName, ThreadState::GCSnapshotI |
{ |
// |dumpBaseName| at this point is "blink_gc/thread_X/heaps/HeapName" |
WebMemoryAllocatorDump* allocatorDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpBaseName); |
- size_t pageIndex = 0; |
- size_t heapTotalFreeSize = 0; |
- size_t heapTotalFreeCount = 0; |
+ size_t pageCount = 0; |
+ BasePage::HeapSnapshotInfo heapInfo; |
for (BasePage* page = m_firstUnsweptPage; page; page = page->next()) { |
- size_t heapPageFreeSize = 0; |
- size_t heapPageFreeCount = 0; |
- page->takeSnapshot(dumpBaseName, pageIndex, info, &heapPageFreeSize, &heapPageFreeCount); |
- heapTotalFreeSize += heapPageFreeSize; |
- heapTotalFreeCount += heapPageFreeCount; |
- pageIndex++; |
+ String dumpName = dumpBaseName + String::format("/pages/page_%lu", static_cast<unsigned long>(pageCount++)); |
+ WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName); |
+ |
+ page->takeSnapshot(pageDump, info, heapInfo); |
} |
- allocatorDump->addScalar("blink_page_count", "objects", pageIndex); |
+ allocatorDump->addScalar("blink_page_count", "objects", pageCount); |
// When taking a full dump (w/ freelist), both the /buckets and /pages |
// report their free size but they are not meant to be added together. |
// Therefore, here we override the free_size of the parent heap to be |
// equal to the free_size of the sum of its heap pages. |
- allocatorDump->addScalar("free_size", "bytes", heapTotalFreeSize); |
- allocatorDump->addScalar("free_count", "objects", heapTotalFreeCount); |
+ allocatorDump->addScalar("free_size", "bytes", heapInfo.freeSize); |
+ allocatorDump->addScalar("free_count", "objects", heapInfo.freeCount); |
} |
#if ENABLE(ASSERT) |
@@ -1391,11 +1388,8 @@ void NormalPage::markOrphaned() |
BasePage::markOrphaned(); |
} |
-void NormalPage::takeSnapshot(String dumpName, size_t pageIndex, ThreadState::GCSnapshotInfo& info, size_t* outFreeSize, size_t* outFreeCount) |
+void NormalPage::takeSnapshot(WebMemoryAllocatorDump* pageDump, ThreadState::GCSnapshotInfo& info, HeapSnapshotInfo& heapInfo) |
{ |
- dumpName.append(String::format("/pages/page_%lu", static_cast<unsigned long>(pageIndex))); |
- WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName); |
- |
HeapObjectHeader* header = nullptr; |
size_t liveCount = 0; |
size_t deadCount = 0; |
@@ -1431,8 +1425,8 @@ void NormalPage::takeSnapshot(String dumpName, size_t pageIndex, ThreadState::GC |
pageDump->addScalar("live_size", "bytes", liveSize); |
pageDump->addScalar("dead_size", "bytes", deadSize); |
pageDump->addScalar("free_size", "bytes", freeSize); |
- *outFreeSize = freeSize; |
- *outFreeCount = freeCount; |
+ heapInfo.freeSize += freeSize; |
+ heapInfo.freeCount += freeCount; |
} |
#if ENABLE(ASSERT) |
@@ -1527,11 +1521,8 @@ void LargeObjectPage::markOrphaned() |
BasePage::markOrphaned(); |
} |
-void LargeObjectPage::takeSnapshot(String dumpName, size_t pageIndex, ThreadState::GCSnapshotInfo& info, size_t* outFreeSize, size_t* outFreeCount) |
+void LargeObjectPage::takeSnapshot(WebMemoryAllocatorDump* pageDump, ThreadState::GCSnapshotInfo& info, HeapSnapshotInfo&) |
{ |
- dumpName.append(String::format("/pages/page_%lu", static_cast<unsigned long>(pageIndex))); |
- WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName); |
- |
size_t liveSize = 0; |
size_t deadSize = 0; |
size_t liveCount = 0; |