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

Unified Diff: third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp

Issue 1375643002: [tracing] directly use memory-infra from blink -> base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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: third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp
diff --git a/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp b/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp
index 5fc5eb725705620696e91f7a86841047ad2a208c..44fc50beebe144b207d4def49b023ac133efaf22 100644
--- a/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp
+++ b/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp
@@ -5,28 +5,31 @@
#include "config.h"
#include "platform/heap/BlinkGCMemoryDumpProvider.h"
+#include "base/trace_event/memory_allocator_dump.h"
+#include "base/trace_event/process_memory_dump.h"
#include "platform/heap/Handle.h"
#include "public/platform/Platform.h"
-#include "public/platform/WebMemoryAllocatorDump.h"
-#include "public/platform/WebProcessMemoryDump.h"
#include "wtf/StdLibExtras.h"
#include "wtf/Threading.h"
namespace blink {
namespace {
-void dumpMemoryTotals(blink::WebProcessMemoryDump* memoryDump)
+using base::trace_event::MemoryAllocatorDump;
+using base::trace_event::ProcessMemoryDump;
+
+void dumpMemoryTotals(ProcessMemoryDump* memoryDump)
{
String dumpName = String::format("blink_gc");
- WebMemoryAllocatorDump* allocatorDump = memoryDump->createMemoryAllocatorDump(dumpName);
+ MemoryAllocatorDump* allocatorDump = memoryDump->CreateAllocatorDump(dumpName.toUTF8StdString());
allocatorDump->AddScalar("size", "bytes", Heap::allocatedSpace());
dumpName.append("/allocated_objects");
- WebMemoryAllocatorDump* objectsDump = memoryDump->createMemoryAllocatorDump(dumpName);
+ MemoryAllocatorDump* objectsDump = memoryDump->CreateAllocatorDump(dumpName.toUTF8StdString());
// Heap::markedObjectSize() can be underestimated if we're still in the
// process of lazy sweeping.
- objectsDump->AddScalar("size", "bytes", Heap::allocatedObjectSize() + Heap::markedObjectSize());
+ objectsDump->AddScalar(MemoryAllocatorDump::kNameSize, MemoryAllocatorDump::kUnitsBytes, Heap::allocatedObjectSize() + Heap::markedObjectSize());
}
} // namespace
@@ -41,9 +44,9 @@ BlinkGCMemoryDumpProvider::~BlinkGCMemoryDumpProvider()
{
}
-bool BlinkGCMemoryDumpProvider::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, blink::WebProcessMemoryDump* memoryDump)
+bool BlinkGCMemoryDumpProvider::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, base::trace_event::ProcessMemoryDump* memoryDump)
{
- if (levelOfDetail == WebMemoryDumpLevelOfDetail::Light) {
+ if (args.level_of_detail == base::trace_event::MemoryDumpLevelOfDetail::LIGHT) {
dumpMemoryTotals(memoryDump);
return true;
}
@@ -52,22 +55,22 @@ bool BlinkGCMemoryDumpProvider::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfD
dumpMemoryTotals(memoryDump);
// Merge all dumps collected by Heap::collectGarbage.
- memoryDump->takeAllDumpsFrom(m_currentProcessMemoryDump.get());
+ memoryDump->TakeAllDumpsFrom(m_currentProcessMemoryDump.get());
return true;
}
-WebMemoryAllocatorDump* BlinkGCMemoryDumpProvider::createMemoryAllocatorDumpForCurrentGC(const String& absoluteName)
+MemoryAllocatorDump* BlinkGCMemoryDumpProvider::createMemoryAllocatorDumpForCurrentGC(const String& absoluteName)
{
- return m_currentProcessMemoryDump->createMemoryAllocatorDump(absoluteName);
+ return m_currentProcessMemoryDump->CreateAllocatorDump(absoluteName.toUTF8StdString());
}
void BlinkGCMemoryDumpProvider::clearProcessDumpForCurrentGC()
{
- m_currentProcessMemoryDump->clear();
+ m_currentProcessMemoryDump->Clear();
}
BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider()
- : m_currentProcessMemoryDump(adoptPtr(Platform::current()->createProcessMemoryDump()))
+ : m_currentProcessMemoryDump(adoptPtr(new base::trace_event::ProcessMemoryDump(nullptr)))
{
}

Powered by Google App Engine
This is Rietveld 408576698