Chromium Code Reviews| Index: Source/platform/heap/BlinkGCMemoryDumpProvider.cpp |
| diff --git a/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp b/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp |
| index 7db5047e1e7f5b82101318b4ab4bb99047ba2e7c..ead6f7be6e581a841c5476d88bff2e28b6c691e4 100644 |
| --- a/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp |
| +++ b/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp |
| @@ -6,6 +6,7 @@ |
| #include "Source/platform/heap/BlinkGCMemoryDumpProvider.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" |
| @@ -18,21 +19,48 @@ BlinkGCMemoryDumpProvider* BlinkGCMemoryDumpProvider::instance() |
| return &instance; |
| } |
| -bool BlinkGCMemoryDumpProvider::onMemoryDump(blink::WebProcessMemoryDump* memoryDump) |
| +BlinkGCMemoryDumpProvider::~BlinkGCMemoryDumpProvider() |
| +{ |
| +} |
| + |
| +bool BlinkGCMemoryDumpProvider::onMemoryDump(WebProcessMemoryDump* memoryDump) |
| { |
| + // The current heap statistics are added to the memory dump. |
| + // TODO(ssid): For consistency these values should be dumped at the time of |
| + // GC (when statistics are collected). crbug.com/491248. |
| WebMemoryAllocatorDump* allocatorDump = memoryDump->createMemoryAllocatorDump("blink_gc"); |
| allocatorDump->AddScalar("inner_size", "bytes", Heap::allocatedObjectSize()); |
| allocatorDump->AddScalar("outer_size", "bytes", Heap::allocatedSpace()); |
| allocatorDump->AddScalar("estimated_live_object_size", "bytes", Heap::estimatedLiveObjectSize()); |
| + |
| + // If available, the last GC memory statistics are added. |
|
haraken
2015/05/26 12:21:59
I'm not sure if this is a good design. I think we
Primiano Tucci (use gerrit)
2015/05/26 14:18:03
See my previous comment on this [1]. Regardless of
|
| + if (m_lastProcessMemoryDump) |
| + memoryDump->takeAllDumpsFrom(m_lastProcessMemoryDump.get()); |
| + |
| + // TODO(ssid): This should return false in the unlikely case that we didn't |
| + // see a GC yet, which in turn will cause the dump to be invalidated. But, |
| + // right now returning false will stop the manager from getting more dumps |
| + // from this provider. So, always returns true while crbug.com/490783 gets |
| + // fixed. |
| + |
| return true; |
| } |
| BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() |
| + : m_lastProcessMemoryDump(adoptPtr(Platform::current()->createProcessMemoryDump())) |
| { |
| } |
| -BlinkGCMemoryDumpProvider::~BlinkGCMemoryDumpProvider() |
| +WebMemoryAllocatorDump* BlinkGCMemoryDumpProvider::createMemoryAllocatorDumpForLastGC(const String& absoluteName) |
|
Primiano Tucci (use gerrit)
2015/05/26 11:24:06
I think this should be PassOwnPtr<WebMemoryAllocat
ssid
2015/05/27 13:15:06
No, the caller can't take the ownership of the ptr
Primiano Tucci (use gerrit)
2015/05/27 14:19:30
Oh right, I didn't realize this comes from createM
|
| +{ |
| + return m_lastProcessMemoryDump->createMemoryAllocatorDump(absoluteName); |
| +} |
| + |
| +void BlinkGCMemoryDumpProvider::clearLastGCProcessMemoryDump() |
|
Primiano Tucci (use gerrit)
2015/05/26 11:24:06
And since you are here, I just realized that a bet
ssid
2015/05/27 13:15:06
removed method.
|
| { |
| + // TODO(ssid): Once the api for clearing dump is available, use that |
| + // instead of this method here (crbug.com/491248). |
| + m_lastProcessMemoryDump = adoptPtr(Platform::current()->createProcessMemoryDump()); |
| } |
| } // namespace blink |