Web Inspector: Native Memory Instrumentation: fix instrumentation for already instrum...
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Jan 2013 08:21:49 +0000 (08:21 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Jan 2013 08:21:49 +0000 (08:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=106546

Reviewed by Vsevolod Vlasov.

Many nontrivial class members were added into reportMemoryUsage methods.

* bindings/v8/V8PerIsolateData.cpp:
(WebCore::V8PerIsolateData::reportMemoryUsage):
* css/CSSMediaRule.cpp:
(WebCore::CSSMediaRule::reportMemoryUsage):
* css/CSSProperty.cpp:
(WebCore::CSSProperty::reportMemoryUsage):
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::reportMemoryUsage):
* css/MediaList.cpp:
(WebCore::MediaList::reportMemoryUsage):
* css/RuleSet.cpp:
(WebCore::RuleData::reportMemoryUsage):
(WebCore::RuleSet::reportMemoryUsage):
(WebCore::RuleSet::RuleSetSelectorPair::reportMemoryUsage):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::MatchedPropertiesCacheItem::reportMemoryUsage):
(WebCore::StyleResolver::reportMemoryUsage):
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::reportMemoryUsage):
* dom/TreeScope.cpp:
(WebCore::TreeScope::reportMemoryUsage):
* inspector/HeapGraphSerializer.cpp:
(WebCore::HeapGraphSerializer::reportMemoryUsage):
* inspector/InspectorMemoryAgent.cpp:
* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::reportMemoryUsage):
* inspector/MemoryInstrumentationImpl.cpp:
(WebCore::MemoryInstrumentationClientImpl::reportMemoryUsage):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::reportMemoryUsage):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::reportMemoryUsage):
* loader/MainResourceLoader.cpp:
(WebCore::MainResourceLoader::reportMemoryUsage):
* loader/Prerenderer.cpp:
(WebCore::Prerenderer::reportMemoryUsage):
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::reportMemoryUsage):
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::reportMemoryUsage):
* page/Page.cpp:
(WebCore::Page::reportMemoryUsage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139589 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/V8PerIsolateData.cpp
Source/WebCore/css/CSSProperty.cpp
Source/WebCore/css/CSSStyleSheet.cpp
Source/WebCore/css/MediaList.cpp
Source/WebCore/css/RuleSet.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleSheetContents.cpp
Source/WebCore/dom/TreeScope.cpp
Source/WebCore/inspector/HeapGraphSerializer.cpp
Source/WebCore/inspector/InspectorMemoryAgent.cpp
Source/WebCore/inspector/InspectorProfilerAgent.cpp
Source/WebCore/inspector/MemoryInstrumentationImpl.cpp
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/MainResourceLoader.cpp
Source/WebCore/loader/Prerenderer.cpp
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/cache/CachedImage.cpp
Source/WebCore/page/Page.cpp

index 406233b..de072d8 100644 (file)
@@ -1,3 +1,55 @@
+2013-01-10  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: Native Memory Instrumentation: fix instrumentation for already instrumented classes 2/N
+        https://bugs.webkit.org/show_bug.cgi?id=106546
+
+        Reviewed by Vsevolod Vlasov.
+
+        Many nontrivial class members were added into reportMemoryUsage methods.
+
+        * bindings/v8/V8PerIsolateData.cpp:
+        (WebCore::V8PerIsolateData::reportMemoryUsage):
+        * css/CSSMediaRule.cpp:
+        (WebCore::CSSMediaRule::reportMemoryUsage):
+        * css/CSSProperty.cpp:
+        (WebCore::CSSProperty::reportMemoryUsage):
+        * css/CSSStyleSheet.cpp:
+        (WebCore::CSSStyleSheet::reportMemoryUsage):
+        * css/MediaList.cpp:
+        (WebCore::MediaList::reportMemoryUsage):
+        * css/RuleSet.cpp:
+        (WebCore::RuleData::reportMemoryUsage):
+        (WebCore::RuleSet::reportMemoryUsage):
+        (WebCore::RuleSet::RuleSetSelectorPair::reportMemoryUsage):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::MatchedPropertiesCacheItem::reportMemoryUsage):
+        (WebCore::StyleResolver::reportMemoryUsage):
+        * css/StyleSheetContents.cpp:
+        (WebCore::StyleSheetContents::reportMemoryUsage):
+        * dom/TreeScope.cpp:
+        (WebCore::TreeScope::reportMemoryUsage):
+        * inspector/HeapGraphSerializer.cpp:
+        (WebCore::HeapGraphSerializer::reportMemoryUsage):
+        * inspector/InspectorMemoryAgent.cpp:
+        * inspector/InspectorProfilerAgent.cpp:
+        (WebCore::InspectorProfilerAgent::reportMemoryUsage):
+        * inspector/MemoryInstrumentationImpl.cpp:
+        (WebCore::MemoryInstrumentationClientImpl::reportMemoryUsage):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::reportMemoryUsage):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::reportMemoryUsage):
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::reportMemoryUsage):
+        * loader/Prerenderer.cpp:
+        (WebCore::Prerenderer::reportMemoryUsage):
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::reportMemoryUsage):
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::reportMemoryUsage):
+        * page/Page.cpp:
+        (WebCore::Page::reportMemoryUsage):
+
 2013-01-13  Levi Weintraub  <leviw@chromium.org>
 
         Unreviewed gardening. Rolling out r139537. It broke platforms without sub-pixel layout.
index f3f4aff..54616a4 100644 (file)
@@ -106,9 +106,19 @@ void V8PerIsolateData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
     info.addMember(m_rawTemplates);
     info.addMember(m_templates);
     info.addMember(m_stringCache);
+    info.addMember(m_integerCache);
     info.addMember(m_domDataList);
+    info.addMember(m_domDataStore);
+    info.addMember(m_hiddenPropertyName);
+    info.addMember(m_gcEventData);
 
     info.addPrivateBuffer(ScriptProfiler::profilerSnapshotsSize(), WebCoreMemoryTypes::InspectorProfilerAgent);
+
+    info.ignoreMember(m_toStringTemplate);
+    info.ignoreMember(m_lazyEventListenerToStringTemplate);
+    info.ignoreMember(m_v8Null);
+    info.ignoreMember(m_liveRoot);
+    info.ignoreMember(m_auxiliaryContext);
 }
 
 #if ENABLE(INSPECTOR)
index b251203..8c3db50 100644 (file)
@@ -701,6 +701,7 @@ void CSSProperty::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     info.addMember(m_value);
+    info.ignoreMember(m_metadata);
 }
 
 } // namespace WebCore
index 0ebbe26..9fc6a73 100644 (file)
@@ -189,6 +189,7 @@ void CSSStyleSheet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.addMember(m_ownerRule);
     info.addMember(m_mediaCSSOMWrapper);
     info.addMember(m_childRuleCSSOMWrappers);
+    info.addMember(m_ruleListCSSOMWrapper);
 }
 
 void CSSStyleSheet::setDisabled(bool disabled)
index 9bf81f1..265b2b4 100644 (file)
@@ -300,6 +300,8 @@ void MediaList::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     info.addMember(m_mediaQueries);
+    info.addMember(m_parentStyleSheet);
+    info.addMember(m_parentRule);
 }
 
 #if ENABLE(RESOLUTION_MEDIA_QUERY)
index d84004d..a30b01c 100644 (file)
@@ -129,6 +129,7 @@ RuleData::RuleData(StyleRule* rule, unsigned selectorIndex, unsigned position, A
 void RuleData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
+    info.addMember(m_rule);
 }
 
 static void reportAtomRuleMap(MemoryClassInfo* info, const RuleSet::AtomRuleMap& atomicRuleMap)
@@ -153,12 +154,14 @@ void RuleSet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.addMember(m_universalRules);
     info.addMember(m_pageRules);
     info.addMember(m_regionSelectorsAndRuleSets);
+    info.addMember(m_features);
 }
 
 void RuleSet::RuleSetSelectorPair::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     info.addMember(ruleSet);
+    info.addMember(selector);
 }
 
 static void collectFeaturesFromRuleData(RuleFeatureSet& features, const RuleData& ruleData)
index 8141bf9..df145da 100644 (file)
@@ -5305,6 +5305,9 @@ void StyleResolver::MatchedPropertiesCacheItem::reportMemoryUsage(MemoryObjectIn
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     info.addMember(matchedProperties);
+    info.addMember(ranges);
+    info.addMember(renderStyle);
+    info.addMember(parentRenderStyle);
 }
 
 void MediaQueryResult::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
@@ -5319,16 +5322,32 @@ void StyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.addMember(m_style);
     info.addMember(m_authorStyle);
     info.addMember(m_userStyle);
+    info.addMember(m_features);
     info.addMember(m_siblingRuleSet);
     info.addMember(m_uncommonAttributeRuleSet);
     info.addMember(m_keyframesRuleMap);
     info.addMember(m_matchedPropertiesCache);
+    info.addMember(m_matchedPropertiesCacheSweepTimer);
     info.addMember(m_matchedRules);
 
     info.addMember(m_ruleList);
     info.addMember(m_pendingImageProperties);
+    info.addMember(m_medium);
+    info.addMember(m_rootDefaultStyle);
+    info.addMember(m_document);
+
+    // FIXME: pointer to RenderStyle could point to an already deleted object.
+    info.ignoreMember(m_parentStyle);
+    info.ignoreMember(m_rootElementStyle);
+
+    info.addMember(m_element);
+    info.addMember(m_styledElement);
+    info.addMember(m_regionForStyling);
+    info.addMember(m_parentNode);
     info.addMember(m_lineHeightValue);
+    info.addMember(m_fontSelector);
     info.addMember(m_viewportDependentMediaQueryResults);
+    info.ignoreMember(m_styleBuilder);
     info.addMember(m_styleRuleToCSSOMWrapperMap);
     info.addMember(m_styleSheetCSSOMWrapperSet);
 #if ENABLE(CSS_FILTERS) && ENABLE(SVG)
index dc521df..6b7c0c5 100644 (file)
@@ -512,11 +512,13 @@ void StyleSheetContents::shrinkToFit()
 void StyleSheetContents::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
+    info.addMember(m_ownerRule);
     info.addMember(m_originalURL);
     info.addMember(m_encodingFromCharsetRule);
     info.addMember(m_importRules);
     info.addMember(m_childRules);
     info.addMember(m_namespaces);
+    info.addMember(m_parserContext);
     info.addMember(m_clients);
 }
 
index 6a577c2..f0d81f3 100644 (file)
@@ -378,6 +378,8 @@ void TreeScope::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.addMember(m_labelsByForAttribute);
     info.addMember(m_idTargetObserverRegistry);
     info.addMember(m_selection);
+    info.addMember(m_documentScope);
+
 }
 
 static void listTreeScopes(Node* node, Vector<TreeScope*, 5>& treeScopes)
index 8fdcb30..19b813d 100644 (file)
@@ -197,6 +197,7 @@ void HeapGraphSerializer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
     info.addMember(m_baseToRealAddress);
     info.addMember(m_nodes);
     info.addMember(m_edges);
+    info.addMember(m_roots);
 }
 
 int HeapGraphSerializer::addString(const String& string)
index 32292c8..b305c08 100644 (file)
@@ -388,6 +388,7 @@ public:
         m_memoryClassInfo = &info;
         ScriptProfiler::visitExternalStrings(const_cast<ExternalStringsRoot*>(this));
         m_memoryClassInfo = 0;
+        info.ignoreMember(m_memoryClassInfo);
     }
 
 private:
@@ -409,6 +410,7 @@ public:
         m_memoryClassInfo = &info;
         ScriptProfiler::visitExternalArrays(const_cast<ExternalArraysRoot*>(this));
         m_memoryClassInfo = 0;
+        info.ignoreMember(m_memoryClassInfo);
     }
 
 private:
index c5c0a22..9adf6f5 100644 (file)
@@ -499,6 +499,7 @@ void InspectorProfilerAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectInf
     info.addWeakPointer(m_frontend);
     info.addMember(m_profiles);
     info.addMember(m_snapshots);
+    info.addMember(m_profileNameIdleTimeMap);
 }
 
 void InspectorProfilerAgent::willProcessTask()
index 52936ab..23474c3 100644 (file)
@@ -126,6 +126,7 @@ void MemoryInstrumentationClientImpl::reportMemoryUsage(MemoryObjectInfo* memory
     info.addMember(m_visitedObjects);
     info.addMember(m_allocatedObjects);
     info.addMember(m_countedObjects);
+    info.addMember(m_graphSerializer);
 }
 
 void MemoryInstrumentationImpl::processDeferredObjects()
index 4537b93..0dba59d 100644 (file)
@@ -360,7 +360,9 @@ void DocumentLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader);
     info.addMember(m_frame);
+    info.addMember(m_cachedResourceLoader);
     info.addMember(m_mainResourceLoader);
+    info.addMember(m_mainResourceData);
     info.addMember(m_subresourceLoaders);
     info.addMember(m_multipartSubresourceLoaders);
     info.addMember(m_plugInStreamLoaders);
@@ -375,10 +377,18 @@ void DocumentLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.addMember(m_lastCheckedRequest);
     info.addMember(m_responses);
     info.addMember(m_pendingSubstituteResources);
+    info.addMember(m_substituteResourceDeliveryTimer);
+    info.addMember(m_archiveResourceCollection);
+#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
+    info.addMember(m_archive);
+    info.addMember(m_parsedArchiveData);
+#endif
     info.addMember(m_resourcesClientKnowsAbout);
     info.addMember(m_resourcesLoadedFromMemoryCacheForClientNotification);
     info.addMember(m_clientRedirectSourceForHistory);
-    info.addMember(m_mainResourceData);
+    info.addMember(m_iconLoadDecisionCallback);
+    info.addMember(m_iconDataCallback);
+    info.addMember(m_applicationCacheHost);
 }
 
 void DocumentLoader::receivedData(const char* data, int length)
index a16b9eb..b7c2dfd 100644 (file)
@@ -3291,11 +3291,21 @@ NetworkingContext* FrameLoader::networkingContext() const
 void FrameLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader);
+    info.addMember(m_frame);
+    info.ignoreMember(m_client);
+    info.addMember(m_progressTracker);
     info.addMember(m_documentLoader);
     info.addMember(m_provisionalDocumentLoader);
     info.addMember(m_policyDocumentLoader);
-    info.addMember(m_outgoingReferrer);
+    info.addMember(m_pendingStateObject);
+    info.addMember(m_submittedFormURL);
+    info.addMember(m_checkTimer);
+    info.addMember(m_opener);
     info.addMember(m_openedFrames);
+    info.addMember(m_outgoingReferrer);
+    info.addMember(m_networkingContext);
+    info.addMember(m_previousUrl);
+    info.addMember(m_requestedHistoryItem);
 }
 
 bool FrameLoaderClient::hasHTMLView() const
index 2d9aa74..571fc81 100644 (file)
@@ -602,9 +602,11 @@ void MainResourceLoader::notifyFinished(CachedResource* resource)
 void MainResourceLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader);
+    info.addMember(m_resource);
     info.addMember(m_initialRequest);
     info.addMember(m_substituteData);
     info.addMember(m_dataLoadTimer);
+    info.addMember(m_documentLoader);
 }
 
 void MainResourceLoader::handleSubstituteDataLoadNow(MainResourceLoaderTimer*)
index c370a6d..dd05e93 100644 (file)
@@ -148,6 +148,7 @@ void Prerenderer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
     ActiveDOMObject::reportMemoryUsage(memoryObjectInfo);
+    info.ignoreMember(m_client);
     info.addMember(m_activeHandles);
     info.addMember(m_suspendedHandles);
 }
index 29ef43b..08567fb 100644 (file)
@@ -539,7 +539,7 @@ AsyncFileStream* ResourceLoader::createAsyncFileStream(FileStreamClient* client)
 void ResourceLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader);
-    info.addMember(m_handle.get());
+    info.addMember(m_handle);
     info.addMember(m_frame);
     info.addMember(m_documentLoader);
     info.addMember(m_request);
index b3cba11..b2cf24b 100644 (file)
@@ -39,6 +39,7 @@
 #include "Settings.h"
 #include "SubresourceLoader.h"
 #include <wtf/CurrentTime.h>
+#include <wtf/MemoryInstrumentationHashMap.h>
 #include <wtf/MemoryObjectInfo.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/Vector.h>
@@ -489,6 +490,7 @@ void CachedImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResourceImage);
     memoryObjectInfo->setClassName("CachedImage");
     CachedResource::reportMemoryUsage(memoryObjectInfo);
+    info.addMember(m_pendingContainerSizeRequests);
     info.addMember(m_image, "m_image");
 #if ENABLE(SVG)
     info.addMember(m_svgImageCache);
index 88bfbfc..5b27e2f 100644 (file)
@@ -1373,6 +1373,7 @@ void Page::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.ignoreMember(m_debugger);
     info.ignoreMember(m_alternativeTextClient);
     info.ignoreMember(m_editorClient);
+    info.ignoreMember(m_plugInClient);
     info.ignoreMember(m_validationMessageClient);
 }