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

Unified Diff: Source/platform/heap/Heap.cpp

Issue 1149673002: Adding blink gc memory dump infrastructure for thread specific dumps. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Making changes for forced GC. Created 5 years, 7 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/platform/heap/Heap.cpp
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp
index da86dc9910321051af139a72fb216daa19533166..621bb84b897e4f6d3578f44b3cb5ed9df3768c0a 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -34,6 +34,7 @@
#include "platform/ScriptForbiddenScope.h"
#include "platform/Task.h"
#include "platform/TraceEvent.h"
+#include "platform/heap/BlinkGCMemoryDumpProvider.h"
#include "platform/heap/CallbackStack.h"
#include "platform/heap/MarkingVisitor.h"
#include "platform/heap/PageMemory.h"
@@ -41,6 +42,7 @@
#include "platform/heap/SafePoint.h"
#include "platform/heap/ThreadState.h"
#include "public/platform/Platform.h"
+#include "public/platform/WebMemoryAllocatorDump.h"
#include "wtf/Assertions.h"
#include "wtf/ContainerAnnotations.h"
#include "wtf/LeakAnnotations.h"
@@ -213,6 +215,16 @@ void BaseHeap::cleanupPages()
m_firstPage = nullptr;
}
+void BaseHeap::takeSnapshot(const String& dumpBaseName)
+{
+ size_t pageCount = 0;
+ for (BasePage* page = m_firstPage; page; page = page->next()) {
+ pageCount++;
+ }
+ WebMemoryAllocatorDump* allocatorDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpBaseName);
+ allocatorDump->AddScalar("blink_page_count", "objects", pageCount);
+}
+
#if ENABLE(ASSERT) || ENABLE(GC_PROFILING)
BasePage* BaseHeap::findPageFromAddress(Address address)
{
@@ -1635,10 +1647,15 @@ void Heap::init()
s_estimatedMarkingTimePerByte = 0.0;
GCInfoTable::init();
+
+ if (Platform::current()->currentThread())
+ Platform::current()->registerMemoryDumpProvider(BlinkGCMemoryDumpProvider::instance());
}
void Heap::shutdown()
{
+ if (Platform::current()->currentThread())
+ Platform::current()->unregisterMemoryDumpProvider(BlinkGCMemoryDumpProvider::instance());
s_shutdownCalled = true;
ThreadState::shutdownHeapIfNecessary();
}

Powered by Google App Engine
This is Rietveld 408576698