From c311cf639cc1d6570d67b0a80a8ba04dc992a658 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 22 Aug 2012 13:36:28 +0200 Subject: Imported WebKit commit 35255d8c2fd37ba4359e75fe0ebe6aec87687f9c (http://svn.webkit.org/repository/webkit/trunk@126284) New snapshot that includes MSVC 64-bit build fix --- Source/WebCore/dom/ElementAttributeData.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'Source/WebCore/dom/ElementAttributeData.cpp') diff --git a/Source/WebCore/dom/ElementAttributeData.cpp b/Source/WebCore/dom/ElementAttributeData.cpp index b743c5e3b..7d89c8848 100644 --- a/Source/WebCore/dom/ElementAttributeData.cpp +++ b/Source/WebCore/dom/ElementAttributeData.cpp @@ -33,9 +33,14 @@ namespace WebCore { +static size_t immutableElementAttributeDataSize(unsigned count) +{ + return sizeof(ElementAttributeData) - sizeof(void*) + sizeof(Attribute) * count; +} + PassOwnPtr ElementAttributeData::createImmutable(const Vector& attributes) { - void* slot = WTF::fastMalloc(sizeof(ElementAttributeData) - sizeof(void*) + sizeof(Attribute) * attributes.size()); + void* slot = WTF::fastMalloc(immutableElementAttributeDataSize(attributes.size())); return adoptPtr(new (slot) ElementAttributeData(attributes)); } @@ -286,15 +291,14 @@ void ElementAttributeData::detachAttrObjectsFromElement(Element* element) const void ElementAttributeData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM); + size_t actualSize = m_isMutable ? sizeof(ElementAttributeData) : immutableElementAttributeDataSize(m_arraySize); + MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM, actualSize); info.addInstrumentedMember(m_inlineStyleDecl); info.addInstrumentedMember(m_attributeStyle); info.addMember(m_classNames); - info.addMember(m_idForStyleResolution); + info.addInstrumentedMember(m_idForStyleResolution); if (m_isMutable) info.addVectorPtr(m_mutableAttributeVector); - else - info.addRawBuffer(m_attributes, m_arraySize * sizeof(Attribute)); for (unsigned i = 0, len = length(); i < len; i++) info.addInstrumentedMember(*attributeItem(i)); } -- cgit v1.2.1