void ElementAttributeData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { size_t actualSize = m_isMutable ? sizeof(ElementAttributeData) : sizeForImmutableElementAttributeDataWithAttributeCount(m_arraySize); MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM, actualSize); info.addMember(m_inlineStyleDecl); info.addMember(m_attributeStyle); info.addMember(m_classNames); info.addMember(m_idForStyleResolution); if (m_isMutable) info.addMember(mutableAttributeVector()); for (unsigned i = 0, len = length(); i < len; i++) info.addMember(*attributeItem(i)); }
PassRefPtr<ElementAttributeData> ElementAttributeData::createImmutable(const Vector<Attribute>& attributes) { void* slot = WTF::fastMalloc(sizeForImmutableElementAttributeDataWithAttributeCount(attributes.size())); return adoptRef(new (slot) ImmutableElementAttributeData(attributes)); }
PassRefPtr<ElementAttributeData> ElementAttributeData::makeImmutableCopy() const { ASSERT(isMutable()); void* slot = WTF::fastMalloc(sizeForImmutableElementAttributeDataWithAttributeCount(mutableAttributeVector().size())); return adoptRef(new (slot) ImmutableElementAttributeData(static_cast<const MutableElementAttributeData&>(*this))); }