Title: [135493] trunk/Source/WebCore
Revision
135493
Author
[email protected]
Date
2012-11-22 01:24:34 -0800 (Thu, 22 Nov 2012)

Log Message

Web Inspector: NMI add instrumentation to DynamicNodeList classes hierarchy.
https://bugs.webkit.org/show_bug.cgi?id=103025

Reviewed by Yury Semikhatsky.

RNiwa changed pointer type in NodeRareData::NodeListAtomicNameCacheMap from the topmost
DynamicSubtreeNodeList to the base DynamicNodeListCacheBase at r135429.
As a result we got non zero count of pointers that don't match with tcmalloc data,
because DynamicNodeList uses multiple inheritance.
It could be fixed with help of explicit native memory instrumentation for DynamicNodeList class hierarchy.

No change in behavior, so no new tests.

* dom/Document.cpp: drive by fix.
(WebCore::Document::reportMemoryUsage):
* dom/DynamicNodeList.cpp:
(WebCore::DynamicNodeListCacheBase::reportMemoryUsage):
(WebCore):
(WebCore::DynamicNodeList::reportMemoryUsage):
(WebCore::DynamicSubtreeNodeList::reportMemoryUsage):
* dom/DynamicNodeList.h:
(WebCore::DynamicNodeListCacheBase::~DynamicNodeListCacheBase):
(DynamicNodeListCacheBase):
(DynamicNodeList):
(DynamicSubtreeNodeList):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135492 => 135493)


--- trunk/Source/WebCore/ChangeLog	2012-11-22 08:56:35 UTC (rev 135492)
+++ trunk/Source/WebCore/ChangeLog	2012-11-22 09:24:34 UTC (rev 135493)
@@ -1,3 +1,31 @@
+2012-11-21  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: NMI add instrumentation to DynamicNodeList classes hierarchy.
+        https://bugs.webkit.org/show_bug.cgi?id=103025
+
+        Reviewed by Yury Semikhatsky.
+
+        RNiwa changed pointer type in NodeRareData::NodeListAtomicNameCacheMap from the topmost
+        DynamicSubtreeNodeList to the base DynamicNodeListCacheBase at r135429.
+        As a result we got non zero count of pointers that don't match with tcmalloc data,
+        because DynamicNodeList uses multiple inheritance.
+        It could be fixed with help of explicit native memory instrumentation for DynamicNodeList class hierarchy.
+
+        No change in behavior, so no new tests.
+
+        * dom/Document.cpp: drive by fix.
+        (WebCore::Document::reportMemoryUsage):
+        * dom/DynamicNodeList.cpp:
+        (WebCore::DynamicNodeListCacheBase::reportMemoryUsage):
+        (WebCore):
+        (WebCore::DynamicNodeList::reportMemoryUsage):
+        (WebCore::DynamicSubtreeNodeList::reportMemoryUsage):
+        * dom/DynamicNodeList.h:
+        (WebCore::DynamicNodeListCacheBase::~DynamicNodeListCacheBase):
+        (DynamicNodeListCacheBase):
+        (DynamicNodeList):
+        (DynamicSubtreeNodeList):
+
 2012-11-22  Kentaro Hara  <[email protected]>
 
         Unreviewed, rolling out r135482.

Modified: trunk/Source/WebCore/dom/Document.cpp (135492 => 135493)


--- trunk/Source/WebCore/dom/Document.cpp	2012-11-22 08:56:35 UTC (rev 135492)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-11-22 09:24:34 UTC (rev 135493)
@@ -5909,6 +5909,7 @@
 #if ENABLE(LINK_PRERENDER)
     info.addMember(m_prerenderer);
 #endif
+    info.addMember(m_listsInvalidatedAtDocument);
 }
 
 class ImmutableAttributeDataCacheKey {

Modified: trunk/Source/WebCore/dom/DynamicNodeList.cpp (135492 => 135493)


--- trunk/Source/WebCore/dom/DynamicNodeList.cpp	2012-11-22 08:56:35 UTC (rev 135492)
+++ trunk/Source/WebCore/dom/DynamicNodeList.cpp	2012-11-22 09:24:34 UTC (rev 135493)
@@ -28,6 +28,7 @@
 #include "HTMLCollection.h"
 #include "HTMLPropertiesCollection.h"
 #include "PropertyNodeList.h"
+#include "WebCoreMemoryInstrumentation.h"
 
 namespace WebCore {
 
@@ -79,6 +80,26 @@
     cacheBase->m_nameCache.clear();
 }
 
+void DynamicNodeListCacheBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
+    info.addMember(m_ownerNode);
+    info.addWeakPointer(m_cachedItem);
+}
+
+void DynamicNodeList::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
+    NodeList::reportMemoryUsage(memoryObjectInfo);
+    DynamicNodeListCacheBase::reportMemoryUsage(memoryObjectInfo);
+}
+
+void DynamicSubtreeNodeList::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
+    DynamicNodeList::reportMemoryUsage(memoryObjectInfo);
+}
+
 unsigned DynamicNodeList::length() const
 {
     return lengthCommon();

Modified: trunk/Source/WebCore/dom/DynamicNodeList.h (135492 => 135493)


--- trunk/Source/WebCore/dom/DynamicNodeList.h	2012-11-22 08:56:35 UTC (rev 135492)
+++ trunk/Source/WebCore/dom/DynamicNodeList.h	2012-11-22 09:24:34 UTC (rev 135493)
@@ -67,6 +67,10 @@
         ASSERT(!m_overridesItemAfter || !isNodeList(collectionType));
     }
 
+    virtual ~DynamicNodeListCacheBase() { }
+
+    virtual void reportMemoryUsage(MemoryObjectInfo*) const;
+
 public:
     ALWAYS_INLINE bool hasIdNameCache() const { return !isNodeList(type()); }
     ALWAYS_INLINE bool isRootedAtDocument() const { return m_rootType == NodeListIsRootedAtDocument || m_rootType == NodeListIsRootedAtDocumentIfOwnerHasItemrefAttr; }
@@ -205,6 +209,8 @@
     // Other methods (not part of DOM)
     virtual bool nodeMatches(Element*) const = 0;
 
+    virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+
 private:
     virtual bool isDynamicNodeList() const OVERRIDE { return true; }
 };
@@ -216,6 +222,8 @@
         document()->unregisterNodeListCache(this);
     }
 
+    virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+
 protected:
     DynamicSubtreeNodeList(PassRefPtr<Node> node, CollectionType type, NodeListInvalidationType invalidationType, NodeListRootType rootType = NodeListIsRootedAtNode)
         : DynamicNodeList(node, type, rootType, invalidationType)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to