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

Unified Diff: third_party/WebKit/Source/platform/SharedBuffer.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: Nits/. Created 5 years, 3 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/platform/SharedBuffer.cpp
diff --git a/third_party/WebKit/Source/platform/SharedBuffer.cpp b/third_party/WebKit/Source/platform/SharedBuffer.cpp
index d678a28fa5fb01dac6864ab458504c56fbf71b20..3c5b2996a55529d5604115cafa21eefd9c660fc4 100644
--- a/third_party/WebKit/Source/platform/SharedBuffer.cpp
+++ b/third_party/WebKit/Source/platform/SharedBuffer.cpp
@@ -27,6 +27,7 @@
#include "config.h"
#include "platform/SharedBuffer.h"
+#include "public/platform/WebProcessMemoryDump.h"
#include "wtf/text/UTF8.h"
#include "wtf/text/Unicode.h"
@@ -410,4 +411,18 @@ bool SharedBuffer::isLocked() const
return m_buffer.isLocked();
}
+void SharedBuffer::onMemoryDump(const String& dumpPrefix, WebProcessMemoryDump* memoryDump) const
+{
+ m_buffer.onMemoryDump(dumpPrefix + "/buffer", memoryDump);
haraken 2015/09/28 14:54:02 /buffer => /shared_buffer
ssid 2015/09/28 16:24:39 Done.
+
+ if (m_size - m_buffer.size() > 0) {
haraken 2015/09/28 14:54:02 Wouldn't it be enough to check: if (!m_buffer.s
ssid 2015/09/28 16:24:39 I was wondering that both can be used at the same
haraken 2015/09/29 02:44:48 Shall we add an ASSERT about it?
+ // If there is data in the segments, then it should have been allocated
+ // using fastMalloc.
+ const String dataDumpName = dumpPrefix + "/data";
haraken 2015/09/28 14:54:02 /data => /segments
ssid 2015/09/28 16:24:38 Done.
+ auto dump = memoryDump->createMemoryAllocatorDump(dataDumpName);
+ dump->AddScalar("size", "bytes", m_size - m_buffer.size());
haraken 2015/09/28 14:54:02 At this point, I think m_buffer.size() is guarante
ssid 2015/09/28 16:24:39 Yeah I was just paranoid..
+ memoryDump->AddSuballocation(dump->guid(), "malloc/allocated_objects");
+ }
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698