Changeset 126139 in webkit
- Timestamp:
- Aug 21, 2012 12:17:53 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r126137 r126139 1 2012-08-20 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: NMI: wrong size was reported for immutable StylePropertySet 4 https://bugs.webkit.org/show_bug.cgi?id=94489 5 6 Reviewed by Yury Semikhatsky. 7 8 Immutable StylePropertySet is created via placement new. 9 The rest of the allocated buffer is used as an array of CSSProperty. 10 This means that we don't need to report m_properties member but have to report actual size of the buffer 11 used for both, the object and CSSProperty array. 12 13 * css/StylePropertySet.cpp: 14 (WebCore::immutableStylePropertySetSize): 15 (WebCore): 16 (WebCore::StylePropertySet::createImmutable): 17 (WebCore::StylePropertySet::reportMemoryUsage): 18 * dom/MemoryInstrumentation.h: 19 (WebCore::MemoryObjectInfo::reportObjectInfo): 20 (WebCore::MemoryClassInfo::MemoryClassInfo): 21 1 22 2012-08-20 Kentaro Hara <haraken@chromium.org> 2 23 -
trunk/Source/WebCore/css/StylePropertySet.cpp
r124884 r126139 51 51 } 52 52 53 static size_t immutableStylePropertySetSize(unsigned count) 54 { 55 return sizeof(StylePropertySet) - sizeof(void*) + sizeof(CSSProperty) * count; 56 } 57 53 58 PassRefPtr<StylePropertySet> StylePropertySet::createImmutable(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode) 54 59 { 55 void* slot = WTF::fastMalloc( sizeof(StylePropertySet) - sizeof(void*) + sizeof(CSSProperty) * count);60 void* slot = WTF::fastMalloc(immutableStylePropertySetSize(count)); 56 61 return adoptRef(new (slot) StylePropertySet(properties, count, cssParserMode, /* makeMutable */ false)); 57 62 } … … 1092 1097 void StylePropertySet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 1093 1098 { 1094 MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS); 1099 size_t actualSize = m_isMutable ? sizeof(StylePropertySet) : immutableStylePropertySetSize(m_arraySize); 1100 MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS, actualSize); 1095 1101 if (m_isMutable) 1096 1102 info.addVectorPtr(m_mutablePropertyVector); 1097 else 1098 info.addRawBuffer(m_properties, m_arraySize * sizeof(CSSProperty)); 1103 1099 1104 unsigned count = propertyCount(); 1100 1105 for (unsigned i = 0; i < count; ++i) -
trunk/Source/WebCore/dom/MemoryInstrumentation.h
r125763 r126139 169 169 friend class MemoryClassInfo; 170 170 171 template <typename T> void reportObjectInfo(MemoryInstrumentation::ObjectType objectType )171 template <typename T> void reportObjectInfo(MemoryInstrumentation::ObjectType objectType, size_t actualSize) 172 172 { 173 173 if (!m_objectSize) { 174 m_objectSize = sizeof(T);174 m_objectSize = actualSize ? actualSize : sizeof(T); 175 175 if (objectType != MemoryInstrumentation::Other) 176 176 m_objectType = objectType; … … 186 186 public: 187 187 template <typename T> 188 MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T*, MemoryInstrumentation::ObjectType objectType )188 MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T*, MemoryInstrumentation::ObjectType objectType, size_t actualSize = 0) 189 189 : m_memoryObjectInfo(memoryObjectInfo) 190 190 , m_memoryInstrumentation(memoryObjectInfo->memoryInstrumentation()) 191 191 { 192 m_memoryObjectInfo->reportObjectInfo<T>(objectType );192 m_memoryObjectInfo->reportObjectInfo<T>(objectType, actualSize); 193 193 m_objectType = memoryObjectInfo->objectType(); 194 194 }
Note: See TracChangeset
for help on using the changeset viewer.