Modified: branches/safari-534.52-branch/Source/WebKit2/Shared/StatisticsData.cpp (98128 => 98129)
--- branches/safari-534.52-branch/Source/WebKit2/Shared/StatisticsData.cpp 2011-10-21 19:54:55 UTC (rev 98128)
+++ branches/safari-534.52-branch/Source/WebKit2/Shared/StatisticsData.cpp 2011-10-21 19:56:10 UTC (rev 98129)
@@ -35,6 +35,7 @@
encoder->encode(statisticsNumbers);
encoder->encode(_javascript_ProtectedObjectTypeCounts);
encoder->encode(_javascript_ObjectTypeCounts);
+ encoder->encode(webCoreCacheStatistics);
}
bool StatisticsData::decode(CoreIPC::ArgumentDecoder* decoder, StatisticsData& statisticsData)
@@ -45,6 +46,8 @@
return false;
if (!decoder->decode(statisticsData._javascript_ObjectTypeCounts))
return false;
+ if (!decoder->decode(statisticsData.webCoreCacheStatistics))
+ return false;
return true;
}
Modified: branches/safari-534.52-branch/Source/WebKit2/Shared/StatisticsData.h (98128 => 98129)
--- branches/safari-534.52-branch/Source/WebKit2/Shared/StatisticsData.h 2011-10-21 19:54:55 UTC (rev 98128)
+++ branches/safari-534.52-branch/Source/WebKit2/Shared/StatisticsData.h 2011-10-21 19:56:10 UTC (rev 98129)
@@ -29,6 +29,7 @@
#include "ArgumentDecoder.h"
#include "ArgumentEncoder.h"
#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
@@ -41,6 +42,7 @@
HashMap<String, uint64_t> statisticsNumbers;
HashMap<String, uint64_t> _javascript_ProtectedObjectTypeCounts;
HashMap<String, uint64_t> _javascript_ObjectTypeCounts;
+ Vector<HashMap<String, uint64_t> > webCoreCacheStatistics;
StatisticsData();
};
Modified: branches/safari-534.52-branch/Source/WebKit2/UIProcess/WebContext.cpp (98128 => 98129)
--- branches/safari-534.52-branch/Source/WebKit2/UIProcess/WebContext.cpp 2011-10-21 19:54:55 UTC (rev 98128)
+++ branches/safari-534.52-branch/Source/WebKit2/UIProcess/WebContext.cpp 2011-10-21 19:56:10 UTC (rev 98129)
@@ -815,6 +815,12 @@
statistics->set("_javascript_ProtectedObjectTypeCounts", createDictionaryFromHashMap(statisticsData._javascript_ProtectedObjectTypeCounts).get());
statistics->set("_javascript_ObjectTypeCounts", createDictionaryFromHashMap(statisticsData._javascript_ObjectTypeCounts).get());
+ size_t cacheStatisticsCount = statisticsData.webCoreCacheStatistics.size();
+ Vector<RefPtr<APIObject> > cacheStatisticsVector(cacheStatisticsCount);
+ for (size_t i = 0; i < cacheStatisticsCount; ++i)
+ cacheStatisticsVector[i] = createDictionaryFromHashMap(statisticsData.webCoreCacheStatistics[i]);
+ statistics->set("WebCoreCacheStatistics", ImmutableArray::adopt(cacheStatisticsVector).get());
+
callback->performCallbackWithReturnValue(statistics.get());
}
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/WebProcess.cpp (98128 => 98129)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/WebProcess.cpp 2011-10-21 19:54:55 UTC (rev 98128)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/WebProcess.cpp 2011-10-21 19:56:10 UTC (rev 98129)
@@ -827,6 +827,82 @@
map.set(it->first, it->second);
}
+static void getWebCoreMemoryCacheStatistics(Vector<HashMap<String, uint64_t> >& result)
+{
+ DEFINE_STATIC_LOCAL(String, imagesString, ("Images"));
+ DEFINE_STATIC_LOCAL(String, cssString, ("CSS"));
+ DEFINE_STATIC_LOCAL(String, xslString, ("XSL"));
+ DEFINE_STATIC_LOCAL(String, _javascript_String, ("_javascript_"));
+
+ MemoryCache::Statistics memoryCacheStatistics = memoryCache()->getStatistics();
+
+ HashMap<String, uint64_t> counts;
+ counts.set(imagesString, memoryCacheStatistics.images.count);
+ counts.set(cssString, memoryCacheStatistics.cssStyleSheets.count);
+#if ENABLE(XSLT)
+ counts.set(xslString, memoryCacheStatistics.xslStyleSheets.count);
+#else
+ counts.set(xslString, 0);
+#endif
+ counts.set(_javascript_String, memoryCacheStatistics.scripts.count);
+ result.append(counts);
+
+ HashMap<String, uint64_t> sizes;
+ sizes.set(imagesString, memoryCacheStatistics.images.size);
+ sizes.set(cssString, memoryCacheStatistics.cssStyleSheets.size);
+#if ENABLE(XSLT)
+ sizes.set(xslString, memoryCacheStatistics.xslStyleSheets.size);
+#else
+ sizes.set(xslString, 0);
+#endif
+ sizes.set(_javascript_String, memoryCacheStatistics.scripts.size);
+ result.append(sizes);
+
+ HashMap<String, uint64_t> liveSizes;
+ liveSizes.set(imagesString, memoryCacheStatistics.images.liveSize);
+ liveSizes.set(cssString, memoryCacheStatistics.cssStyleSheets.liveSize);
+#if ENABLE(XSLT)
+ liveSizes.set(xslString, memoryCacheStatistics.xslStyleSheets.liveSize);
+#else
+ liveSizes.set(xslString, 0);
+#endif
+ liveSizes.set(_javascript_String, memoryCacheStatistics.scripts.liveSize);
+ result.append(liveSizes);
+
+ HashMap<String, uint64_t> decodedSizes;
+ decodedSizes.set(imagesString, memoryCacheStatistics.images.decodedSize);
+ decodedSizes.set(cssString, memoryCacheStatistics.cssStyleSheets.decodedSize);
+#if ENABLE(XSLT)
+ decodedSizes.set(xslString, memoryCacheStatistics.xslStyleSheets.decodedSize);
+#else
+ decodedSizes.set(xslString, 0);
+#endif
+ decodedSizes.set(_javascript_String, memoryCacheStatistics.scripts.decodedSize);
+ result.append(decodedSizes);
+
+ HashMap<String, uint64_t> purgeableSizes;
+ purgeableSizes.set(imagesString, memoryCacheStatistics.images.purgeableSize);
+ purgeableSizes.set(cssString, memoryCacheStatistics.cssStyleSheets.purgeableSize);
+#if ENABLE(XSLT)
+ purgeableSizes.set(xslString, memoryCacheStatistics.xslStyleSheets.purgeableSize);
+#else
+ purgeableSizes.set(xslString, 0);
+#endif
+ purgeableSizes.set(_javascript_String, memoryCacheStatistics.scripts.purgeableSize);
+ result.append(purgeableSizes);
+
+ HashMap<String, uint64_t> purgedSizes;
+ purgedSizes.set(imagesString, memoryCacheStatistics.images.purgedSize);
+ purgedSizes.set(cssString, memoryCacheStatistics.cssStyleSheets.purgedSize);
+#if ENABLE(XSLT)
+ purgedSizes.set(xslString, memoryCacheStatistics.xslStyleSheets.purgedSize);
+#else
+ purgedSizes.set(xslString, 0);
+#endif
+ purgedSizes.set(_javascript_String, memoryCacheStatistics.scripts.purgedSize);
+ result.append(purgedSizes);
+}
+
void WebProcess::getWebCoreStatistics(uint64_t callbackID)
{
StatisticsData data;
@@ -868,7 +944,8 @@
// Gather glyph page statistics.
data.statisticsNumbers.set("GlyphPageCount", GlyphPageTreeNode::treeGlyphPageCount());
- // FIXME: Gather WebCore cache statistics.
+ // Get WebCore memory cache statistics
+ getWebCoreMemoryCacheStatistics(data.webCoreCacheStatistics);
m_connection->send(Messages::WebContext::DidGetWebCoreStatistics(data, callbackID), 0);
}