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..406ed90f8ba9e3d8aa98a4c018d2a6da571b81e9 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,46 @@ 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. |
| WebMemoryAllocatorDump* allocatorDump = memoryDump->createMemoryAllocatorDump("blink_gc"); |
|
Primiano Tucci (use gerrit)
2015/05/22 19:45:57
No need to do in this CL, but I think that, for th
ssid
2015/05/26 11:08:43
Done.
|
| 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. |
| + if (m_lastProcessMemoryDump.get()) |
|
Primiano Tucci (use gerrit)
2015/05/22 19:45:57
nit: OwnPtr, like scoped_ptr, has the implicit-con
ssid
2015/05/26 11:08:42
Done.
|
| + 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() |
|
Primiano Tucci (use gerrit)
2015/05/22 19:45:57
micro-nit: I think it was right to keep this on th
ssid
2015/05/26 11:08:42
Keeping it in decl order.
|
| + : m_lastProcessMemoryDump(adoptPtr(Platform::current()->createProcessMemoryDump())) |
| { |
| } |
| -BlinkGCMemoryDumpProvider::~BlinkGCMemoryDumpProvider() |
| +WebMemoryAllocatorDump* BlinkGCMemoryDumpProvider::createMemoryAllocatorDumpForLastGC(const String& absoluteName) |
| +{ |
| + return m_lastProcessMemoryDump->createMemoryAllocatorDump(absoluteName); |
| +} |
| + |
| +void BlinkGCMemoryDumpProvider::clearLastProcessMemoryDump() |
|
Primiano Tucci (use gerrit)
2015/05/22 19:45:57
Nit: +GC (i.e. clearLastGC...)
ssid
2015/05/26 11:08:42
Done.
|
| { |
| + // 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 |