Title: [123396] trunk/Source/WebCore
Revision
123396
Author
[email protected]
Date
2012-07-23 15:56:30 -0700 (Mon, 23 Jul 2012)

Log Message

Report the extra memory used by immutable StylePropertySet objects.
<http://webkit.org/b/92032>

Reviewed by Anders Carlsson.

Add an optional parameter to the MemoryClassInfo constructor for passing in additional base object
size on top of sizeof(T).

Use this in StylePropertySet::reportMemoryUsage() to properly account for the CSSProperty array
tacked onto the end of the object when m_isMutable == false.

* css/StylePropertySet.h:
(WebCore::StylePropertySet::reportMemoryUsage):
* dom/MemoryInstrumentation.h:
(WebCore::MemoryObjectInfo::reportObjectInfo):
(WebCore::MemoryClassInfo::MemoryClassInfo):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123395 => 123396)


--- trunk/Source/WebCore/ChangeLog	2012-07-23 22:53:25 UTC (rev 123395)
+++ trunk/Source/WebCore/ChangeLog	2012-07-23 22:56:30 UTC (rev 123396)
@@ -1,3 +1,22 @@
+2012-07-23  Andreas Kling  <[email protected]>
+
+        Report the extra memory used by immutable StylePropertySet objects.
+        <http://webkit.org/b/92032>
+
+        Reviewed by Anders Carlsson.
+
+        Add an optional parameter to the MemoryClassInfo constructor for passing in additional base object
+        size on top of sizeof(T).
+
+        Use this in StylePropertySet::reportMemoryUsage() to properly account for the CSSProperty array
+        tacked onto the end of the object when m_isMutable == false.
+
+        * css/StylePropertySet.h:
+        (WebCore::StylePropertySet::reportMemoryUsage):
+        * dom/MemoryInstrumentation.h:
+        (WebCore::MemoryObjectInfo::reportObjectInfo):
+        (WebCore::MemoryClassInfo::MemoryClassInfo):
+
 2012-07-23  Gregg Tavares  <[email protected]>
 
         Fix WebGL texSubImage2D for cube maps

Modified: trunk/Source/WebCore/css/StylePropertySet.h (123395 => 123396)


--- trunk/Source/WebCore/css/StylePropertySet.h	2012-07-23 22:53:25 UTC (rev 123395)
+++ trunk/Source/WebCore/css/StylePropertySet.h	2012-07-23 22:56:30 UTC (rev 123396)
@@ -118,7 +118,7 @@
     
     void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     {
-        MemoryClassInfo<StylePropertySet> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+        MemoryClassInfo<StylePropertySet> info(memoryObjectInfo, this, MemoryInstrumentation::CSS, m_arraySize * sizeof(CSSProperty));
         if (m_isMutable)
             info.addMember(m_mutablePropertyVector);
     }

Modified: trunk/Source/WebCore/dom/MemoryInstrumentation.h (123395 => 123396)


--- trunk/Source/WebCore/dom/MemoryInstrumentation.h	2012-07-23 22:53:25 UTC (rev 123395)
+++ trunk/Source/WebCore/dom/MemoryInstrumentation.h	2012-07-23 22:56:30 UTC (rev 123396)
@@ -157,12 +157,12 @@
 private:
     template <typename T> friend class MemoryClassInfo;
 
-    template <typename T> void reportObjectInfo(const T*, MemoryInstrumentation::ObjectType objectType)
+    template <typename T> void reportObjectInfo(const T*, MemoryInstrumentation::ObjectType objectType, size_t extraObjectSize)
     {
         if (m_objectType != MemoryInstrumentation::Other)
             return;
         m_objectType = objectType;
-        m_objectSize = sizeof(T);
+        m_objectSize = sizeof(T) + extraObjectSize;
     }
 
     MemoryInstrumentation* m_memoryInstrumentation;
@@ -191,11 +191,11 @@
 template <typename T>
 class MemoryClassInfo {
 public:
-    MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T* ptr, MemoryInstrumentation::ObjectType objectType)
+    MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T* ptr, MemoryInstrumentation::ObjectType objectType, size_t extraObjectSize = 0)
         : m_memoryObjectInfo(memoryObjectInfo)
         , m_memoryInstrumentation(memoryObjectInfo->memoryInstrumentation())
     {
-        m_memoryObjectInfo->reportObjectInfo(ptr, objectType);
+        m_memoryObjectInfo->reportObjectInfo(ptr, objectType, extraObjectSize);
         m_objectType = memoryObjectInfo->objectType();
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to