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..3a1ed1af141517ae6769dce6644826da3d3e6cd7 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,36 @@ 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 (!hasClients() && canDelete() && type() != MainResource) { |
|
haraken
2015/09/29 02:44:48
- !hasClients() isn't needed since canDelete() has
ssid
2015/09/29 11:06:36
The pruneDeadResources prunes the resources with t
|
| + dump->AddScalar("dead_size", "bytes", m_encodedSize); |
| + } else { |
| + dump->AddScalar("live_size", "bytes", m_encodedSize); |
| + } |
| + |
| + size_t totalSize = encodedSize() + overheadSize(); |
| + dump->AddScalar("purged_size", "bytes", wasPurged() ? totalSize : 0); |
| + if (m_data) { |
| + dump->AddScalar("purgeable_size", "bytes", isPurgeable() ? 0 : totalSize); |
|
haraken
2015/09/29 02:44:48
It won't make sense to dump both purged_size and p
ssid
2015/09/29 11:06:37
If was_purged returns true, it meand that discarda
|
| + 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); |