Title: [124444] trunk/Source/WebCore
Revision
124444
Author
[email protected]
Date
2012-08-02 05:52:27 -0700 (Thu, 02 Aug 2012)

Log Message

Web Inspector: remove extraObjectSize parameter from MemoryClassInfo constructor
https://bugs.webkit.org/show_bug.cgi?id=92981

Reviewed by Alexander Pavlov.

Refactored MemoryInstrumentation to get rid of extraSize parameter from
MemoryObjectInfo constructor and MemoryObjectInfo::reportObjectInfo. The
extra size should always be reported as an object that occupies these extra
bytes.

* dom/ElementAttributeData.cpp:
(WebCore::ElementAttributeData::reportMemoryUsage):
(WebCore):
* dom/ElementAttributeData.h:
(WebCore):
(ElementAttributeData):
* dom/MemoryInstrumentation.h:
(WebCore::MemoryObjectInfo::reportObjectInfo):
(WebCore::MemoryClassInfo::MemoryClassInfo):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124443 => 124444)


--- trunk/Source/WebCore/ChangeLog	2012-08-02 12:33:47 UTC (rev 124443)
+++ trunk/Source/WebCore/ChangeLog	2012-08-02 12:52:27 UTC (rev 124444)
@@ -1,3 +1,25 @@
+2012-08-02  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: remove extraObjectSize parameter from MemoryClassInfo constructor
+        https://bugs.webkit.org/show_bug.cgi?id=92981
+
+        Reviewed by Alexander Pavlov.
+
+        Refactored MemoryInstrumentation to get rid of extraSize parameter from
+        MemoryObjectInfo constructor and MemoryObjectInfo::reportObjectInfo. The
+        extra size should always be reported as an object that occupies these extra
+        bytes.
+
+        * dom/ElementAttributeData.cpp:
+        (WebCore::ElementAttributeData::reportMemoryUsage):
+        (WebCore):
+        * dom/ElementAttributeData.h:
+        (WebCore):
+        (ElementAttributeData):
+        * dom/MemoryInstrumentation.h:
+        (WebCore::MemoryObjectInfo::reportObjectInfo):
+        (WebCore::MemoryClassInfo::MemoryClassInfo):
+
 2012-08-02  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r124439.

Modified: trunk/Source/WebCore/dom/ElementAttributeData.cpp (124443 => 124444)


--- trunk/Source/WebCore/dom/ElementAttributeData.cpp	2012-08-02 12:33:47 UTC (rev 124443)
+++ trunk/Source/WebCore/dom/ElementAttributeData.cpp	2012-08-02 12:52:27 UTC (rev 124444)
@@ -28,6 +28,7 @@
 
 #include "Attr.h"
 #include "CSSStyleSheet.h"
+#include "MemoryInstrumentation.h"
 #include "StyledElement.h"
 
 namespace WebCore {
@@ -283,6 +284,19 @@
     ASSERT(!element->hasAttrList());
 }
 
+void ElementAttributeData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<ElementAttributeData> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
+    info.addInstrumentedMember(m_inlineStyleDecl);
+    info.addInstrumentedMember(m_attributeStyle);
+    info.addMember(m_classNames);
+    info.addString(m_idForStyleResolution);
+    if (m_isMutable)
+        info.addVectorPtr(m_mutableAttributeVector);
+    else
+        info.addRawBuffer(m_attributes, m_arraySize * sizeof(Attribute));
+}
+
 size_t ElementAttributeData::getAttributeItemIndexSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase) const
 {
     // Continue to checking case-insensitively and/or full namespaced names if necessary:

Modified: trunk/Source/WebCore/dom/ElementAttributeData.h (124443 => 124444)


--- trunk/Source/WebCore/dom/ElementAttributeData.h	2012-08-02 12:33:47 UTC (rev 124443)
+++ trunk/Source/WebCore/dom/ElementAttributeData.h	2012-08-02 12:52:27 UTC (rev 124444)
@@ -27,7 +27,6 @@
 #define ElementAttributeData_h
 
 #include "Attribute.h"
-#include "MemoryInstrumentation.h"
 #include "SpaceSplitString.h"
 #include "StylePropertySet.h"
 #include <wtf/NotFound.h>
@@ -36,6 +35,7 @@
 
 class Attr;
 class Element;
+class MemoryObjectInfo;
 
 enum EInUpdateStyleAttribute { NotInUpdateStyleAttribute, InUpdateStyleAttribute };
 
@@ -94,16 +94,7 @@
     PassRefPtr<Attr> ensureAttr(Element*, const QualifiedName&) const;
     void detachAttrObjectsFromElement(Element*) const;
 
-    void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
-    {
-        MemoryClassInfo<ElementAttributeData> info(memoryObjectInfo, this, MemoryInstrumentation::DOM, m_arraySize * sizeof(Attribute));
-        info.addInstrumentedMember(m_inlineStyleDecl.get());
-        info.addInstrumentedMember(m_attributeStyle.get());
-        info.addMember(m_classNames);
-        info.addString(m_idForStyleResolution);
-        if (m_isMutable)
-            info.addVector(*m_mutableAttributeVector);
-    }
+    void reportMemoryUsage(MemoryObjectInfo*) const;
 
 private:
     friend class Element;

Modified: trunk/Source/WebCore/dom/MemoryInstrumentation.h (124443 => 124444)


--- trunk/Source/WebCore/dom/MemoryInstrumentation.h	2012-08-02 12:33:47 UTC (rev 124443)
+++ trunk/Source/WebCore/dom/MemoryInstrumentation.h	2012-08-02 12:52:27 UTC (rev 124444)
@@ -145,12 +145,12 @@
 private:
     template <typename T> friend class MemoryClassInfo;
 
-    template <typename T> void reportObjectInfo(const T*, MemoryInstrumentation::ObjectType objectType, size_t extraObjectSize)
+    template <typename T> void reportObjectInfo(const T*, MemoryInstrumentation::ObjectType objectType)
     {
         if (m_objectType != MemoryInstrumentation::Other)
             return;
         m_objectType = objectType;
-        m_objectSize = sizeof(T) + extraObjectSize;
+        m_objectSize = sizeof(T);
     }
 
     MemoryInstrumentation* m_memoryInstrumentation;
@@ -161,11 +161,11 @@
 template <typename T>
 class MemoryClassInfo {
 public:
-    MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T* ptr, MemoryInstrumentation::ObjectType objectType, size_t extraObjectSize = 0)
+    MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T* ptr, MemoryInstrumentation::ObjectType objectType)
         : m_memoryObjectInfo(memoryObjectInfo)
         , m_memoryInstrumentation(memoryObjectInfo->memoryInstrumentation())
     {
-        m_memoryObjectInfo->reportObjectInfo(ptr, objectType, extraObjectSize);
+        m_memoryObjectInfo->reportObjectInfo(ptr, objectType);
         m_objectType = memoryObjectInfo->objectType();
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to