Changeset 124444 in webkit


Ignore:
Timestamp:
Aug 2, 2012 5:52:27 AM (12 years ago)
Author:
yurys@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r124443 r124444  
     12012-08-02  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: remove extraObjectSize parameter from MemoryClassInfo constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=92981
     5
     6        Reviewed by Alexander Pavlov.
     7
     8        Refactored MemoryInstrumentation to get rid of extraSize parameter from
     9        MemoryObjectInfo constructor and MemoryObjectInfo::reportObjectInfo. The
     10        extra size should always be reported as an object that occupies these extra
     11        bytes.
     12
     13        * dom/ElementAttributeData.cpp:
     14        (WebCore::ElementAttributeData::reportMemoryUsage):
     15        (WebCore):
     16        * dom/ElementAttributeData.h:
     17        (WebCore):
     18        (ElementAttributeData):
     19        * dom/MemoryInstrumentation.h:
     20        (WebCore::MemoryObjectInfo::reportObjectInfo):
     21        (WebCore::MemoryClassInfo::MemoryClassInfo):
     22
    1232012-08-02  Sheriff Bot  <webkit.review.bot@gmail.com>
    224
  • trunk/Source/WebCore/dom/ElementAttributeData.cpp

    r123636 r124444  
    2929#include "Attr.h"
    3030#include "CSSStyleSheet.h"
     31#include "MemoryInstrumentation.h"
    3132#include "StyledElement.h"
    3233
     
    282283    // The loop above should have cleaned out this element's Attr map.
    283284    ASSERT(!element->hasAttrList());
     285}
     286
     287void ElementAttributeData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     288{
     289    MemoryClassInfo<ElementAttributeData> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
     290    info.addInstrumentedMember(m_inlineStyleDecl);
     291    info.addInstrumentedMember(m_attributeStyle);
     292    info.addMember(m_classNames);
     293    info.addString(m_idForStyleResolution);
     294    if (m_isMutable)
     295        info.addVectorPtr(m_mutableAttributeVector);
     296    else
     297        info.addRawBuffer(m_attributes, m_arraySize * sizeof(Attribute));
    284298}
    285299
  • trunk/Source/WebCore/dom/ElementAttributeData.h

    r123636 r124444  
    2828
    2929#include "Attribute.h"
    30 #include "MemoryInstrumentation.h"
    3130#include "SpaceSplitString.h"
    3231#include "StylePropertySet.h"
     
    3736class Attr;
    3837class Element;
     38class MemoryObjectInfo;
    3939
    4040enum EInUpdateStyleAttribute { NotInUpdateStyleAttribute, InUpdateStyleAttribute };
     
    9595    void detachAttrObjectsFromElement(Element*) const;
    9696
    97     void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
    98     {
    99         MemoryClassInfo<ElementAttributeData> info(memoryObjectInfo, this, MemoryInstrumentation::DOM, m_arraySize * sizeof(Attribute));
    100         info.addInstrumentedMember(m_inlineStyleDecl.get());
    101         info.addInstrumentedMember(m_attributeStyle.get());
    102         info.addMember(m_classNames);
    103         info.addString(m_idForStyleResolution);
    104         if (m_isMutable)
    105             info.addVector(*m_mutableAttributeVector);
    106     }
     97    void reportMemoryUsage(MemoryObjectInfo*) const;
    10798
    10899private:
  • trunk/Source/WebCore/dom/MemoryInstrumentation.h

    r124412 r124444  
    146146    template <typename T> friend class MemoryClassInfo;
    147147
    148     template <typename T> void reportObjectInfo(const T*, MemoryInstrumentation::ObjectType objectType, size_t extraObjectSize)
     148    template <typename T> void reportObjectInfo(const T*, MemoryInstrumentation::ObjectType objectType)
    149149    {
    150150        if (m_objectType != MemoryInstrumentation::Other)
    151151            return;
    152152        m_objectType = objectType;
    153         m_objectSize = sizeof(T) + extraObjectSize;
     153        m_objectSize = sizeof(T);
    154154    }
    155155
     
    162162class MemoryClassInfo {
    163163public:
    164     MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T* ptr, MemoryInstrumentation::ObjectType objectType, size_t extraObjectSize = 0)
     164    MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T* ptr, MemoryInstrumentation::ObjectType objectType)
    165165        : m_memoryObjectInfo(memoryObjectInfo)
    166166        , m_memoryInstrumentation(memoryObjectInfo->memoryInstrumentation())
    167167    {
    168         m_memoryObjectInfo->reportObjectInfo(ptr, objectType, extraObjectSize);
     168        m_memoryObjectInfo->reportObjectInfo(ptr, objectType);
    169169        m_objectType = memoryObjectInfo->objectType();
    170170    }
Note: See TracChangeset for help on using the changeset viewer.