Diff
Modified: trunk/Source/WebCore/ChangeLog (121967 => 121968)
--- trunk/Source/WebCore/ChangeLog 2012-07-06 13:23:56 UTC (rev 121967)
+++ trunk/Source/WebCore/ChangeLog 2012-07-06 14:09:12 UTC (rev 121968)
@@ -1,3 +1,29 @@
+2012-07-06 Alexei Filippov <[email protected]>
+
+ Web Inspector: Add native memory used by GlyphCache to the snapshot
+ https://bugs.webkit.org/show_bug.cgi?id=90615
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/InspectorMemoryAgent.cpp:
+ (MemoryBlockName):
+ (WebCore):
+ (WebCore::addPlatformComponentsInfo):
+ (WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):
+ * inspector/front-end/NativeMemorySnapshotView.js:
+ (WebInspector.MemoryBlockViewProperties._initialize):
+ * platform/MemoryUsageSupport.cpp:
+ (WebCore::MemoryUsageSupport::memoryUsageByComponents):
+ (WebCore):
+ * platform/MemoryUsageSupport.h:
+ (MemoryUsageSupport):
+ (ComponentInfo):
+ (WebCore::MemoryUsageSupport::ComponentInfo::ComponentInfo):
+ * platform/chromium/MemoryUsageSupportChromium.cpp:
+ (WebCore::glyphCacheVisitor):
+ (WebCore):
+ (WebCore::MemoryUsageSupport::memoryUsageByComponents):
+
2012-07-06 Oswald Buddenhagen <[email protected]>
[Qt] Switch to new-style Qt 5 configure tests
Modified: trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp (121967 => 121968)
--- trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp 2012-07-06 13:23:56 UTC (rev 121967)
+++ trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp 2012-07-06 14:09:12 UTC (rev 121968)
@@ -544,6 +544,17 @@
return domTreesIterator.dumpStatistics();
}
+static void addPlatformComponentsInfo(PassRefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children)
+{
+ Vector<MemoryUsageSupport::ComponentInfo> components;
+ MemoryUsageSupport::memoryUsageByComponents(components);
+ for (Vector<MemoryUsageSupport::ComponentInfo>::iterator it = components.begin(); it != components.end(); ++it) {
+ RefPtr<InspectorMemoryBlock> block = InspectorMemoryBlock::create().setName(it->m_name);
+ block->setSize(it->m_sizeInBytes);
+ children->addItem(block);
+ }
+}
+
static PassRefPtr<InspectorMemoryBlock> memoryCacheInfo()
{
MemoryCache::Statistics stats = memoryCache()->getStatistics();
@@ -602,6 +613,7 @@
children->addItem(renderTreeInfo(m_page)); // TODO: collect for all pages?
children->addItem(domTreeInfo(m_page, visitedObjects)); // TODO: collect for all pages?
children->addItem(jsExternalResourcesInfo(visitedObjects));
+ addPlatformComponentsInfo(children);
processMemory->setChildren(children);
}
Modified: trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js (121967 => 121968)
--- trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js 2012-07-06 13:23:56 UTC (rev 121967)
+++ trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js 2012-07-06 14:09:12 UTC (rev 121968)
@@ -224,6 +224,7 @@
addBlock("hsl( 90, 50%, 80%)", "JSExternalStrings", "_javascript_ external strings");
addBlock("hsl(210, 60%, 80%)", "InspectorData", "Inspector data");
addBlock("hsl( 30, 60%, 80%)", "MemoryCache", "Memory cache resources");
+ addBlock("hsl( 40, 60%, 80%)", "GlyphCache", "Glyph cache resources");
addBlock("hsl( 60, 60%, 80%)", "RenderTreeAllocated", "Render tree");
addBlock("hsl( 60, 60%, 80%)", "RenderTreeUsed", "Render tree used");
}
Modified: trunk/Source/WebCore/platform/MemoryUsageSupport.cpp (121967 => 121968)
--- trunk/Source/WebCore/platform/MemoryUsageSupport.cpp 2012-07-06 13:23:56 UTC (rev 121967)
+++ trunk/Source/WebCore/platform/MemoryUsageSupport.cpp 2012-07-06 14:09:12 UTC (rev 121968)
@@ -63,4 +63,8 @@
return false;
}
+void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>&)
+{
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/MemoryUsageSupport.h (121967 => 121968)
--- trunk/Source/WebCore/platform/MemoryUsageSupport.h 2012-07-06 13:23:56 UTC (rev 121967)
+++ trunk/Source/WebCore/platform/MemoryUsageSupport.h 2012-07-06 14:09:12 UTC (rev 121968)
@@ -31,6 +31,9 @@
#ifndef MemoryUsageSupport_h
#define MemoryUsageSupport_h
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
namespace WebCore {
class MemoryUsageSupport {
@@ -57,6 +60,17 @@
// memory currently allocated to this process that cannot be shared. Returns
// false on platform specific error conditions.
static bool processMemorySizesInBytes(size_t* privateBytes, size_t* sharedBytes);
+
+ class ComponentInfo {
+ public:
+ ComponentInfo(const String& name, size_t size) : m_name(name), m_sizeInBytes(size) { }
+
+ const String m_name;
+ size_t m_sizeInBytes;
+ };
+
+ // Reports private memory used by components in bytes.
+ static void memoryUsageByComponents(Vector<ComponentInfo>&);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp (121967 => 121968)
--- trunk/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp 2012-07-06 13:23:56 UTC (rev 121967)
+++ trunk/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp 2012-07-06 14:09:12 UTC (rev 121968)
@@ -32,6 +32,7 @@
#include "MemoryUsageSupport.h"
#include <public/Platform.h>
+#include <third_party/skia/src/core/SkGlyphCache.h>
namespace WebCore {
@@ -65,4 +66,18 @@
return WebKit::Platform::current()->processMemorySizesInBytes(privateBytes, sharedBytes);
}
+static bool glyphCacheVisitor(SkGlyphCache* cache, void* context)
+{
+ size_t* sizePtr = reinterpret_cast<size_t*>(context);
+ *sizePtr += sizeof(*cache);
+ return false;
+}
+
+void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>& components)
+{
+ size_t size = 0;
+ SkGlyphCache::VisitAllCaches(glyphCacheVisitor, &size);
+ components.append(ComponentInfo("GlyphCache", size));
+}
+
} // namespace WebCore