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

Unified Diff: third_party/WebKit/Source/core/fetch/Resource.cpp

Issue 1369253002: Add Web Resources usage to chrome://tracing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web_cache2_base
Patch Set: Fix names. 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/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 157a18ff8960602655c979a7ef9fe7e6c1641b84..0c93f4fb9203423365762ddfa82f5ee625d147c7 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,33 @@ 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);
+ 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() && !wasPurged() ? encodedSize() + overheadSize() : 0);
+ m_data->onMemoryDump(dumpName, memoryDump);
+ }
+
+ const String overheadName = dumpName + "/metadata";
+ WebMemoryAllocatorDump* overheadDump = memoryDump->createMemoryAllocatorDump(overheadName);
+ overheadDump->AddScalar("size", "bytes", overheadSize());
+ memoryDump->AddSuballocation(overheadDump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName));
+}
+
+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);
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | third_party/WebKit/Source/core/fetch/ScriptResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698