summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/ElementAttributeData.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-22 13:36:28 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-22 13:36:28 +0200
commitc311cf639cc1d6570d67b0a80a8ba04dc992a658 (patch)
tree6e16fefc7ece11ce4ec1e475a58a537a7acebaf8 /Source/WebCore/dom/ElementAttributeData.cpp
parent5ef7c8a6a70875d4430752d146bdcb069605d71d (diff)
downloadqtwebkit-c311cf639cc1d6570d67b0a80a8ba04dc992a658.tar.gz
Imported WebKit commit 35255d8c2fd37ba4359e75fe0ebe6aec87687f9c (http://svn.webkit.org/repository/webkit/trunk@126284)
New snapshot that includes MSVC 64-bit build fix
Diffstat (limited to 'Source/WebCore/dom/ElementAttributeData.cpp')
-rw-r--r--Source/WebCore/dom/ElementAttributeData.cpp14
1 files changed, 9 insertions, 5 deletions
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> ElementAttributeData::createImmutable(const Vector<Attribute>& 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));
}