Chromium Code Reviews| Index: third_party/WebKit/Source/core/fetch/Resource.cpp |
| diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp |
| index f1aaf35ded75c5e9d21ed0548344ec9bd3c24798..9e0f07f9218d11d64525565c40da93ce763397b5 100644 |
| --- a/third_party/WebKit/Source/core/fetch/Resource.cpp |
| +++ b/third_party/WebKit/Source/core/fetch/Resource.cpp |
| @@ -39,6 +39,7 @@ |
| #include "platform/TraceEvent.h" |
| #include "platform/weborigin/KURL.h" |
| #include "public/platform/Platform.h" |
| +#include "public/platform/WebProcessMemoryDump.h" |
| #include "wtf/CurrentTime.h" |
| #include "wtf/MathExtras.h" |
| #include "wtf/StdLibExtras.h" |
| @@ -717,6 +718,34 @@ void Resource::prune() |
| unlock(); |
| } |
| +void Resource::onMemoryDump(WebProcessMemoryDump* memoryDump) const |
| +{ |
| + const String dumpName = getMemoryDumpName(); |
| + WebMemoryAllocatorDump* dump = memoryDump->createMemoryAllocatorDump(dumpName); |
| + dump->AddScalar("encoded_size", "bytes", m_encodedSize); |
| + dump->AddScalar("decoded_size", "bytes", m_decodedSize); |
| + if (canDelete()) { |
| + dump->AddScalar("dead_size", "bytes", m_encodedSize); |
| + } else { |
| + dump->AddScalar("live_size", "bytes", m_encodedSize); |
| + } |
| + |
| + if (m_data) { |
| + dump->AddScalar("purgeable_size", "bytes", isPurgeable() ? encodedSize() + overheadSize() : 0); |
|
haraken
2015/09/29 12:36:47
Maybe we need a bit more tweak on this. Please loo
ssid
2015/09/29 16:10:00
Done.
|
| + m_data->onMemoryDump(dumpName, memoryDump); |
| + } |
| + |
| + const String overheadName = dumpName + "/overhead"; |
| + WebMemoryAllocatorDump* overheadDump = memoryDump->createMemoryAllocatorDump(overheadName); |
| + overheadDump->AddScalar("size", "bytes", overheadSize()); |
| + memoryDump->AddSuballocation(overheadDump->guid(), String(WTF::Partitions::allocatorPoolNameForTracing())); |
| +} |
| + |
| +String Resource::getMemoryDumpName() const |
| +{ |
| + return String::format("web_cache/%s_resources/%ld", resourceTypeToString(type(), options().initiatorInfo), m_identifier); |
| +} |
| + |
| void Resource::setResourceToRevalidate(Resource* resource) |
| { |
| ASSERT(resource); |