Web Inspector: add memory instrumentation for CSSValue and its descendants
authoryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Aug 2012 14:09:59 +0000 (14:09 +0000)
committeryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Aug 2012 14:09:59 +0000 (14:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=93130

Reviewed by Pavel Feldman.

Added memory footprint reporting routine to CSSValue and its descendants.

Memory reporing for CSSValue is organized in a following way:
- CSSValue implements reportMemoryUsage method that switches by the value
  type and calls reportDescendantMemoryUsage on the concrete type
- There may be some intermediate classes in the inheritance chain between
  CSSValue and the leaf class implementing reportDescendantMemoryUsage. Those
  intermediate classes implement reportBaseClassMemoryUsage method that can
  be called from a descendant to collect memory information for the base class
  members. Having reportDescendantMemoryUsage only on the leaf classes prevents
  us from accidentally adding the intermediate classes to the switch block
  in the CSSValue::reportMemoryUsage.

* css/CSSAspectRatioValue.cpp:
(WebCore::CSSAspectRatioValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSAspectRatioValue.h:
(CSSAspectRatioValue):
* css/CSSBorderImageSliceValue.cpp:
(WebCore::CSSBorderImageSliceValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSBorderImageSliceValue.h:
(CSSBorderImageSliceValue):
* css/CSSCalculationValue.cpp:
(WebCore):
(WebCore::CSSCalcValue::reportDescendantMemoryUsage):
(CSSCalcPrimitiveValue):
* css/CSSCalculationValue.h:
(CSSCalcExpressionNode):
(CSSCalcValue):
* css/CSSCanvasValue.cpp:
(WebCore::CSSCanvasValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSCanvasValue.h:
(CSSCanvasValue):
* css/CSSCrossfadeValue.cpp:
(WebCore::CSSCrossfadeValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSCrossfadeValue.h:
(CSSCrossfadeValue):
* css/CSSCursorImageValue.cpp:
(WebCore::CSSCursorImageValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSCursorImageValue.h:
(CSSCursorImageValue):
* css/CSSFontFaceSrcValue.cpp:
(WebCore::CSSFontFaceSrcValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSFontFaceSrcValue.h:
(CSSFontFaceSrcValue):
* css/CSSFunctionValue.cpp:
(WebCore::CSSFunctionValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSFunctionValue.h:
(CSSFunctionValue):
* css/CSSGradientValue.cpp:
(WebCore::CSSGradientColorStop::reportMemoryUsage):
(WebCore):
(WebCore::CSSGradientValue::reportBaseClassMemoryUsage):
(WebCore::CSSLinearGradientValue::reportDescendantMemoryUsage):
(WebCore::CSSRadialGradientValue::reportDescendantMemoryUsage):
* css/CSSGradientValue.h:
(CSSGradientColorStop):
(CSSGradientValue):
(CSSLinearGradientValue):
(CSSRadialGradientValue):
* css/CSSImageGeneratorValue.cpp:
(WebCore::CSSImageGeneratorValue::reportBaseClassMemoryUsage):
(WebCore):
* css/CSSImageGeneratorValue.h:
(CSSImageGeneratorValue):
* css/CSSImageSetValue.cpp:
(WebCore::CSSImageSetValue::reportDescendantMemoryUsage):
(WebCore):
(WebCore::CSSImageSetValue::ImageWithScale::reportMemoryUsage):
* css/CSSImageSetValue.h:
(ImageWithScale):
(CSSImageSetValue):
* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSImageValue.h:
(CSSImageValue):
* css/CSSInheritedValue.cpp:
(WebCore::CSSInheritedValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSInheritedValue.h:
(CSSInheritedValue):
* css/CSSInitialValue.cpp:
(WebCore::CSSInitialValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSInitialValue.h:
(CSSInitialValue):
* css/CSSLineBoxContainValue.cpp:
(WebCore::CSSLineBoxContainValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSLineBoxContainValue.h:
(CSSLineBoxContainValue):
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSPrimitiveValue.h:
(CSSPrimitiveValue):
* css/CSSReflectValue.cpp:
(WebCore::CSSReflectValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSReflectValue.h:
(CSSReflectValue):
* css/CSSTimingFunctionValue.cpp:
(WebCore::CSSLinearTimingFunctionValue::reportDescendantMemoryUsage):
(WebCore):
(WebCore::CSSCubicBezierTimingFunctionValue::reportDescendantMemoryUsage):
(WebCore::CSSStepsTimingFunctionValue::reportDescendantMemoryUsage):
* css/CSSTimingFunctionValue.h:
(CSSLinearTimingFunctionValue):
(CSSCubicBezierTimingFunctionValue):
(CSSStepsTimingFunctionValue):
* css/CSSUnicodeRangeValue.cpp:
(WebCore::CSSUnicodeRangeValue::reportDescendantMemoryUsage):
(WebCore):
* css/CSSUnicodeRangeValue.h:
(CSSUnicodeRangeValue):
* css/CSSValue.cpp:
(WebCore::TextCloneCSSValue::reportDescendantMemoryUsage):
(TextCloneCSSValue):
(WebCore::CSSValue::reportMemoryUsage):
(WebCore):
* css/CSSValue.h:
(WebCore):
(CSSValue):
* css/CSSValueList.cpp:
(WebCore::CSSValueList::reportDescendantMemoryUsage):
(WebCore):
* css/CSSValueList.h:
(CSSValueList):
* css/CSSVariableValue.h:
(WebCore::CSSVariableValue::reportDescendantMemoryUsage):
(CSSVariableValue):
* css/FontFeatureValue.cpp:
(WebCore::FontFeatureValue::reportDescendantMemoryUsage):
(WebCore):
* css/FontFeatureValue.h:
(FontFeatureValue):
* css/FontValue.cpp:
(WebCore::FontValue::reportDescendantMemoryUsage):
(WebCore):
* css/FontValue.h:
(FontValue):
* css/MediaQueryExp.cpp:
(WebCore::MediaQueryExp::reportMemoryUsage):
* css/ShadowValue.cpp:
(WebCore::ShadowValue::reportDescendantMemoryUsage):
(WebCore):
* css/ShadowValue.h:
(ShadowValue):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList):
* css/WebKitCSSFilterValue.cpp:
(WebCore::WebKitCSSFilterValue::reportDescendantMemoryUsage):
(WebCore):
* css/WebKitCSSFilterValue.h:
(WebKitCSSFilterValue):
* css/WebKitCSSSVGDocumentValue.cpp:
(WebCore::WebKitCSSSVGDocumentValue::reportDescendantMemoryUsage):
(WebCore):
* css/WebKitCSSSVGDocumentValue.h:
(WebKitCSSSVGDocumentValue):
* css/WebKitCSSShaderValue.cpp:
(WebCore::WebKitCSSShaderValue::reportDescendantMemoryUsage):
(WebCore):
* css/WebKitCSSShaderValue.h:
(WebKitCSSShaderValue):
* css/WebKitCSSTransformValue.cpp:
(WebCore::WebKitCSSTransformValue::reportDescendantMemoryUsage):
(WebCore):
* css/WebKitCSSTransformValue.h:
(WebKitCSSTransformValue):
* dom/MemoryInstrumentation.cpp:
(WebCore::MemoryInstrumentation::addString):
(WebCore):
* dom/MemoryInstrumentation.h:
(MemoryInstrumentation):
(WebCore::MemoryClassInfo::addHashCountedSet):
(WebCore::MemoryClassInfo::addMember):
* svg/SVGColor.cpp:
(WebCore::SVGColor::reportDescendantMemoryUsage):
(WebCore):
* svg/SVGColor.h:
(SVGColor):
* svg/SVGPaint.cpp:
(WebCore::SVGPaint::reportDescendantMemoryUsage):
(WebCore):
* svg/SVGPaint.h:
(SVGPaint):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@124768 268f45cc-cd09-0410-ab3c-d52691b4dbfc

71 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSAspectRatioValue.cpp
Source/WebCore/css/CSSAspectRatioValue.h
Source/WebCore/css/CSSBorderImageSliceValue.cpp
Source/WebCore/css/CSSBorderImageSliceValue.h
Source/WebCore/css/CSSCalculationValue.cpp
Source/WebCore/css/CSSCalculationValue.h
Source/WebCore/css/CSSCanvasValue.cpp
Source/WebCore/css/CSSCanvasValue.h
Source/WebCore/css/CSSCrossfadeValue.cpp
Source/WebCore/css/CSSCrossfadeValue.h
Source/WebCore/css/CSSCursorImageValue.cpp
Source/WebCore/css/CSSCursorImageValue.h
Source/WebCore/css/CSSFontFaceSrcValue.cpp
Source/WebCore/css/CSSFontFaceSrcValue.h
Source/WebCore/css/CSSFunctionValue.cpp
Source/WebCore/css/CSSFunctionValue.h
Source/WebCore/css/CSSGradientValue.cpp
Source/WebCore/css/CSSGradientValue.h
Source/WebCore/css/CSSImageGeneratorValue.cpp
Source/WebCore/css/CSSImageGeneratorValue.h
Source/WebCore/css/CSSImageSetValue.cpp
Source/WebCore/css/CSSImageSetValue.h
Source/WebCore/css/CSSImageValue.cpp
Source/WebCore/css/CSSImageValue.h
Source/WebCore/css/CSSInheritedValue.cpp
Source/WebCore/css/CSSInheritedValue.h
Source/WebCore/css/CSSInitialValue.cpp
Source/WebCore/css/CSSInitialValue.h
Source/WebCore/css/CSSLineBoxContainValue.cpp
Source/WebCore/css/CSSLineBoxContainValue.h
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSPrimitiveValue.h
Source/WebCore/css/CSSProperty.cpp
Source/WebCore/css/CSSProperty.h
Source/WebCore/css/CSSReflectValue.cpp
Source/WebCore/css/CSSReflectValue.h
Source/WebCore/css/CSSTimingFunctionValue.cpp
Source/WebCore/css/CSSTimingFunctionValue.h
Source/WebCore/css/CSSUnicodeRangeValue.cpp
Source/WebCore/css/CSSUnicodeRangeValue.h
Source/WebCore/css/CSSValue.cpp
Source/WebCore/css/CSSValue.h
Source/WebCore/css/CSSValueList.cpp
Source/WebCore/css/CSSValueList.h
Source/WebCore/css/CSSVariableValue.h
Source/WebCore/css/FontFeatureValue.cpp
Source/WebCore/css/FontFeatureValue.h
Source/WebCore/css/FontValue.cpp
Source/WebCore/css/FontValue.h
Source/WebCore/css/MediaQueryExp.cpp
Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
Source/WebCore/css/ShadowValue.cpp
Source/WebCore/css/ShadowValue.h
Source/WebCore/css/StylePropertySet.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/css/WebKitCSSFilterValue.cpp
Source/WebCore/css/WebKitCSSFilterValue.h
Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp
Source/WebCore/css/WebKitCSSSVGDocumentValue.h
Source/WebCore/css/WebKitCSSShaderValue.cpp
Source/WebCore/css/WebKitCSSShaderValue.h
Source/WebCore/css/WebKitCSSTransformValue.cpp
Source/WebCore/css/WebKitCSSTransformValue.h
Source/WebCore/dom/MemoryInstrumentation.cpp
Source/WebCore/dom/MemoryInstrumentation.h
Source/WebCore/svg/SVGColor.cpp
Source/WebCore/svg/SVGColor.h
Source/WebCore/svg/SVGPaint.cpp
Source/WebCore/svg/SVGPaint.h

index e403874d7277188f676feda71ffb76e50e1470e4..5c20628b36676e710c11483350df5fa027cd3464 100644 (file)
@@ -1,3 +1,205 @@
+2012-08-03  Yury Semikhatsky  <yurys@chromium.org>
+
+        Web Inspector: add memory instrumentation for CSSValue and its descendants
+        https://bugs.webkit.org/show_bug.cgi?id=93130
+
+        Reviewed by Pavel Feldman.
+
+        Added memory footprint reporting routine to CSSValue and its descendants.
+
+        Memory reporing for CSSValue is organized in a following way:
+        - CSSValue implements reportMemoryUsage method that switches by the value
+          type and calls reportDescendantMemoryUsage on the concrete type
+        - There may be some intermediate classes in the inheritance chain between
+          CSSValue and the leaf class implementing reportDescendantMemoryUsage. Those
+          intermediate classes implement reportBaseClassMemoryUsage method that can
+          be called from a descendant to collect memory information for the base class
+          members. Having reportDescendantMemoryUsage only on the leaf classes prevents
+          us from accidentally adding the intermediate classes to the switch block
+          in the CSSValue::reportMemoryUsage.
+
+        * css/CSSAspectRatioValue.cpp:
+        (WebCore::CSSAspectRatioValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSAspectRatioValue.h:
+        (CSSAspectRatioValue):
+        * css/CSSBorderImageSliceValue.cpp:
+        (WebCore::CSSBorderImageSliceValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSBorderImageSliceValue.h:
+        (CSSBorderImageSliceValue):
+        * css/CSSCalculationValue.cpp:
+        (WebCore):
+        (WebCore::CSSCalcValue::reportDescendantMemoryUsage):
+        (CSSCalcPrimitiveValue):
+        * css/CSSCalculationValue.h:
+        (CSSCalcExpressionNode):
+        (CSSCalcValue):
+        * css/CSSCanvasValue.cpp:
+        (WebCore::CSSCanvasValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSCanvasValue.h:
+        (CSSCanvasValue):
+        * css/CSSCrossfadeValue.cpp:
+        (WebCore::CSSCrossfadeValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSCrossfadeValue.h:
+        (CSSCrossfadeValue):
+        * css/CSSCursorImageValue.cpp:
+        (WebCore::CSSCursorImageValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSCursorImageValue.h:
+        (CSSCursorImageValue):
+        * css/CSSFontFaceSrcValue.cpp:
+        (WebCore::CSSFontFaceSrcValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSFontFaceSrcValue.h:
+        (CSSFontFaceSrcValue):
+        * css/CSSFunctionValue.cpp:
+        (WebCore::CSSFunctionValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSFunctionValue.h:
+        (CSSFunctionValue):
+        * css/CSSGradientValue.cpp:
+        (WebCore::CSSGradientColorStop::reportMemoryUsage):
+        (WebCore):
+        (WebCore::CSSGradientValue::reportBaseClassMemoryUsage):
+        (WebCore::CSSLinearGradientValue::reportDescendantMemoryUsage):
+        (WebCore::CSSRadialGradientValue::reportDescendantMemoryUsage):
+        * css/CSSGradientValue.h:
+        (CSSGradientColorStop):
+        (CSSGradientValue):
+        (CSSLinearGradientValue):
+        (CSSRadialGradientValue):
+        * css/CSSImageGeneratorValue.cpp:
+        (WebCore::CSSImageGeneratorValue::reportBaseClassMemoryUsage):
+        (WebCore):
+        * css/CSSImageGeneratorValue.h:
+        (CSSImageGeneratorValue):
+        * css/CSSImageSetValue.cpp:
+        (WebCore::CSSImageSetValue::reportDescendantMemoryUsage):
+        (WebCore):
+        (WebCore::CSSImageSetValue::ImageWithScale::reportMemoryUsage):
+        * css/CSSImageSetValue.h:
+        (ImageWithScale):
+        (CSSImageSetValue):
+        * css/CSSImageValue.cpp:
+        (WebCore::CSSImageValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSImageValue.h:
+        (CSSImageValue):
+        * css/CSSInheritedValue.cpp:
+        (WebCore::CSSInheritedValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSInheritedValue.h:
+        (CSSInheritedValue):
+        * css/CSSInitialValue.cpp:
+        (WebCore::CSSInitialValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSInitialValue.h:
+        (CSSInitialValue):
+        * css/CSSLineBoxContainValue.cpp:
+        (WebCore::CSSLineBoxContainValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSLineBoxContainValue.h:
+        (CSSLineBoxContainValue):
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSPrimitiveValue.h:
+        (CSSPrimitiveValue):
+        * css/CSSReflectValue.cpp:
+        (WebCore::CSSReflectValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSReflectValue.h:
+        (CSSReflectValue):
+        * css/CSSTimingFunctionValue.cpp:
+        (WebCore::CSSLinearTimingFunctionValue::reportDescendantMemoryUsage):
+        (WebCore):
+        (WebCore::CSSCubicBezierTimingFunctionValue::reportDescendantMemoryUsage):
+        (WebCore::CSSStepsTimingFunctionValue::reportDescendantMemoryUsage):
+        * css/CSSTimingFunctionValue.h:
+        (CSSLinearTimingFunctionValue):
+        (CSSCubicBezierTimingFunctionValue):
+        (CSSStepsTimingFunctionValue):
+        * css/CSSUnicodeRangeValue.cpp:
+        (WebCore::CSSUnicodeRangeValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSUnicodeRangeValue.h:
+        (CSSUnicodeRangeValue):
+        * css/CSSValue.cpp:
+        (WebCore::TextCloneCSSValue::reportDescendantMemoryUsage):
+        (TextCloneCSSValue):
+        (WebCore::CSSValue::reportMemoryUsage):
+        (WebCore):
+        * css/CSSValue.h:
+        (WebCore):
+        (CSSValue):
+        * css/CSSValueList.cpp:
+        (WebCore::CSSValueList::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/CSSValueList.h:
+        (CSSValueList):
+        * css/CSSVariableValue.h:
+        (WebCore::CSSVariableValue::reportDescendantMemoryUsage):
+        (CSSVariableValue):
+        * css/FontFeatureValue.cpp:
+        (WebCore::FontFeatureValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/FontFeatureValue.h:
+        (FontFeatureValue):
+        * css/FontValue.cpp:
+        (WebCore::FontValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/FontValue.h:
+        (FontValue):
+        * css/MediaQueryExp.cpp:
+        (WebCore::MediaQueryExp::reportMemoryUsage):
+        * css/ShadowValue.cpp:
+        (WebCore::ShadowValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/ShadowValue.h:
+        (ShadowValue):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::collectMatchingRulesForList):
+        * css/WebKitCSSFilterValue.cpp:
+        (WebCore::WebKitCSSFilterValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/WebKitCSSFilterValue.h:
+        (WebKitCSSFilterValue):
+        * css/WebKitCSSSVGDocumentValue.cpp:
+        (WebCore::WebKitCSSSVGDocumentValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/WebKitCSSSVGDocumentValue.h:
+        (WebKitCSSSVGDocumentValue):
+        * css/WebKitCSSShaderValue.cpp:
+        (WebCore::WebKitCSSShaderValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/WebKitCSSShaderValue.h:
+        (WebKitCSSShaderValue):
+        * css/WebKitCSSTransformValue.cpp:
+        (WebCore::WebKitCSSTransformValue::reportDescendantMemoryUsage):
+        (WebCore):
+        * css/WebKitCSSTransformValue.h:
+        (WebKitCSSTransformValue):
+        * dom/MemoryInstrumentation.cpp:
+        (WebCore::MemoryInstrumentation::addString):
+        (WebCore):
+        * dom/MemoryInstrumentation.h:
+        (MemoryInstrumentation):
+        (WebCore::MemoryClassInfo::addHashCountedSet):
+        (WebCore::MemoryClassInfo::addMember):
+        * svg/SVGColor.cpp:
+        (WebCore::SVGColor::reportDescendantMemoryUsage):
+        (WebCore):
+        * svg/SVGColor.h:
+        (SVGColor):
+        * svg/SVGPaint.cpp:
+        (WebCore::SVGPaint::reportDescendantMemoryUsage):
+        (WebCore):
+        * svg/SVGPaint.h:
+        (SVGPaint):
+
 2012-08-06  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector: rename WorkerAgent.setWorkerInspectionEnabled to WorkerAgent.enable and make it return error
index 18b0ded6736ee1449f8701ee99a97102eb3cb537..b07f7ba669cafa2fd83cc7f4f5bcffc25e11c7fc 100644 (file)
@@ -29,6 +29,7 @@
 #include "config.h"
 #include "CSSAspectRatioValue.h"
 
+#include "MemoryInstrumentation.h"
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -42,4 +43,9 @@ String CSSAspectRatioValue::customCssText() const
     return result.toString();
 }
 
+void CSSAspectRatioValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSAspectRatioValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+}
+
 }
index 2f6b426d8c0a83a96f95ec90bb2bcf6aaca3fc25..5cc339249bb5131ab6665d1e2820b4d8d782d41f 100644 (file)
@@ -46,6 +46,8 @@ public:
     float numeratorValue() const { return m_numeratorValue; }
     float denominatorValue() const { return m_denominatorValue; }
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSAspectRatioValue(float numeratorValue, float denominatorValue)
         : CSSValue(AspectRatioClass)
index 04ef2d366c80c32e767c76950c65610d6cb652d0..ff73acaf84916e2d73191b6eaf9c8ad5f97f2dc3 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "CSSBorderImageSliceValue.h"
 
+#include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 #include "Rect.h"
 
@@ -49,4 +50,10 @@ String CSSBorderImageSliceValue::customCssText() const
     return text;
 }
 
+void CSSBorderImageSliceValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSBorderImageSliceValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addInstrumentedMember(m_slices);
+}
+
 } // namespace WebCore
index d8230f474ebf9f4ad489e77cea2164ed487ce66f..488b4a41d20dfaf2c422c61438053e145ef446f6 100644 (file)
@@ -45,6 +45,8 @@ public:
 
     Quad* slices() { return m_slices ? m_slices->getQuadValue() : 0; }
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
     // These four values are used to make "cuts" in the border image. They can be numbers
     // or percentages.
     RefPtr<CSSPrimitiveValue> m_slices;
index 54247e0359fb47481ccab2784fe04428ccd7c4f4..bc8edd93f1a320316408610a96f63d2be51b1d50 100755 (executable)
@@ -33,6 +33,7 @@
 
 #include "CSSValueList.h"
 #include "Length.h"
+#include "MemoryInstrumentation.h"
 #include "StyleResolver.h"
 
 #include <wtf/OwnPtr.h>
@@ -86,6 +87,11 @@ String CSSCalcValue::customCssText() const
         result.append(')');
     return result.toString(); 
 }
+
+void CSSCalcValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSCalcValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+}
     
 double CSSCalcValue::clampToPermittedRange(double value) const
 {
@@ -175,6 +181,12 @@ public:
         }
         return 0;        
     }
+
+    virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE
+    {
+        MemoryClassInfo<CSSCalcPrimitiveValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+        info.addInstrumentedMember(m_value);
+    }
     
 private:
     explicit CSSCalcPrimitiveValue(CSSPrimitiveValue* value, bool isInteger)
@@ -260,6 +272,13 @@ public:
         return evaluate(leftValue, rightValue);
     }
 
+    virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE
+    {
+        MemoryClassInfo<CSSCalcBinaryOperation> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+        info.addInstrumentedMember(m_leftSide);
+        info.addInstrumentedMember(m_rightSide);
+    }
+
     virtual String customCssText() const
     {
         StringBuilder result;
index 57a249f8968c51648286ee741045717edee6676f..b25f7b31a5022c08b8ff6d5a626d0c43744f4916 100755 (executable)
@@ -64,6 +64,8 @@ public:
     virtual double doubleValue() const = 0;
     virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const = 0;
     virtual String customCssText() const = 0;
+
+    virtual void reportMemoryUsage(MemoryObjectInfo*) const = 0;
     
     CalculationCategory category() const { return m_category; }    
     bool isInteger() const { return m_isInteger; }
@@ -95,6 +97,8 @@ public:
     double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const;
         
     String customCssText() const;
+
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
     
 private:    
     CSSCalcValue(PassRefPtr<CSSCalcExpressionNode> expression, CalculationPermittedValueRange range)
index 783ceef82b50f885e37059e75de156dedf27d161..c0ade42e0340d97cbc5a22e6a70a7ad28e8ef7a5 100644 (file)
@@ -27,6 +27,7 @@
 #include "CSSCanvasValue.h"
 
 #include "ImageBuffer.h"
+#include "MemoryInstrumentation.h"
 #include "RenderObject.h"
 
 namespace WebCore {
@@ -92,4 +93,12 @@ PassRefPtr<Image> CSSCanvasValue::image(RenderObject* renderer, const IntSize& /
     return elt->copiedImage();
 }
 
+void CSSCanvasValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSCanvasValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    CSSImageGeneratorValue::reportBaseClassMemoryUsage(memoryObjectInfo);
+    info.addMember(m_name);
+    info.addInstrumentedMember(m_element);
+}
+
 } // namespace WebCore
index 159e619568ba5038c571dc145d89efd965fe4d94..13fb58741e570d5b4a53df3252e4e3c8666144c8 100644 (file)
@@ -47,6 +47,8 @@ public:
     bool isPending() const { return false; }
     void loadSubimages(CachedResourceLoader*) { }
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSCanvasValue(const String& name)
         : CSSImageGeneratorValue(CanvasClass)
index a95d1e73b76c7f68578e84b4c5ead15b9a895a48..66b3d3edf7edaec211e5445341aa4a3ab0d04497 100644 (file)
@@ -31,6 +31,7 @@
 #include "CachedResourceLoader.h"
 #include "CrossfadeGeneratedImage.h"
 #include "ImageBuffer.h"
+#include "MemoryInstrumentation.h"
 #include "RenderObject.h"
 #include "StyleCachedImage.h"
 #include "StyleGeneratedImage.h"
@@ -134,6 +135,19 @@ void CSSCrossfadeValue::loadSubimages(CachedResourceLoader* cachedResourceLoader
     m_crossfadeSubimageObserver.setReady(true);
 }
 
+void CSSCrossfadeValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSCrossfadeValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    CSSImageGeneratorValue::reportBaseClassMemoryUsage(memoryObjectInfo);
+    info.addInstrumentedMember(m_fromValue);
+    info.addInstrumentedMember(m_toValue);
+    info.addInstrumentedMember(m_percentageValue);
+    // FIXME: add instrumentation for
+    // m_cachedFromImage
+    // m_cachedToImage
+    // m_generatedImage
+}
+
 PassRefPtr<Image> CSSCrossfadeValue::image(RenderObject* renderer, const IntSize& size)
 {
     if (size.isEmpty())
index 89a72c4e9272dd0d704e1b7e4a15cd95ae9cee7f..f5267ebcde3579a60f7bce6f40ea588db9b5b437 100644 (file)
@@ -63,6 +63,8 @@ public:
 
     bool hasFailedOrCanceledSubresources() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSCrossfadeValue(PassRefPtr<CSSValue> fromValue, PassRefPtr<CSSValue> toValue)
         : CSSImageGeneratorValue(CrossfadeClass)
index f8506848ff7454c4027c0f2c11d14a84bbe628eb..77c3c9396f083615a7fef41fb0d1537402115b85 100644 (file)
@@ -23,6 +23,7 @@
 #include "CSSCursorImageValue.h"
 
 #include "CachedResourceLoader.h"
+#include "MemoryInstrumentation.h"
 #include "TreeScope.h"
 #include "PlatformString.h"
 #include <wtf/MathExtras.h>
@@ -132,4 +133,13 @@ void CSSCursorImageValue::removeReferencedElement(SVGElement* element)
 }
 #endif
 
+void CSSCursorImageValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSCursorImageValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    CSSImageValue::reportDescendantMemoryUsage(memoryObjectInfo);
+#if ENABLE(SVG)
+    info.addInstrumentedHashSet(m_referencedElements);
+#endif
+}
+
 } // namespace WebCore
index cb26919e4683d625567e78749a7c80ffc9ce0ee7..dc8d1ff4ca5f586528e97062cd5e98d66f6b12eb 100644 (file)
@@ -48,6 +48,8 @@ public:
     void removeReferencedElement(SVGElement*);
 #endif
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSCursorImageValue(const String& url, const IntPoint& hotSpot);
 
index 605b2fce71a988a0e046e35b6c6bb6f18147d03f..9716140d8769d178656c21c96930222751e2506f 100644 (file)
@@ -29,7 +29,9 @@
 #include "CachedResourceLoader.h"
 #include "Document.h"
 #include "FontCustomPlatformData.h"
+#include "MemoryInstrumentation.h"
 #include "Node.h"
+#include "SVGFontFaceElement.h"
 #include "StyleSheetContents.h"
 
 namespace WebCore {
@@ -95,5 +97,16 @@ CachedFont* CSSFontFaceSrcValue::cachedFont(Document* document)
     return m_cachedFont.get();
 }
 
+void CSSFontFaceSrcValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSFontFaceSrcValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addMember(m_resource);
+    info.addMember(m_format);
+    // FIXME: add m_cachedFont when MemoryCache is instrumented.
+#if ENABLE(SVG_FONTS)
+    info.addInstrumentedMember(m_svgFontFaceElement);
+#endif
+}
+
 }
 
index 06ef4b330790015b5f1402dc945048fdbe0c9d43..4444c860692ab68e257ff8f6556ce012f98aafcc 100644 (file)
@@ -71,6 +71,8 @@ public:
 
     CachedFont* cachedFont(Document*);
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSFontFaceSrcValue(const String& resource, bool local)
         : CSSValue(FontFaceSrcClass)
index 522ad9fd164a7d5d4adccfaeabf76c7c8b36615a..53dc43fb382d3b6ab3cbcd152d2473ed664cec57 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "CSSParserValues.h"
 #include "CSSValueList.h"
+#include "MemoryInstrumentation.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -49,4 +50,11 @@ String CSSFunctionValue::customCssText() const
     return result;
 }
 
+void CSSFunctionValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSFunctionValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addMember(m_name);
+    info.addInstrumentedMember(m_args);
+}
+
 }
index a35a1b17b3102899bebfdd1e18cc13b4c7f6b7bf..6b7fbc65e4e4f1c07ca52e123fcfdaed571936cc 100644 (file)
@@ -42,6 +42,8 @@ public:
 
     String customCssText() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     explicit CSSFunctionValue(CSSParserFunction*);
 
index 3f1979fee5004d3ebbd8fd7a51db7173fad1fe03..3076d2af62a9af095697c92a5b520ab7bc0ce891 100644 (file)
@@ -33,6 +33,7 @@
 #include "Image.h"
 #include "IntSize.h"
 #include "IntSizeHash.h"
+#include "MemoryInstrumentation.h"
 #include "NodeRenderStyle.h"
 #include "PlatformString.h"
 #include "RenderObject.h"
@@ -42,6 +43,13 @@ using namespace std;
 
 namespace WebCore {
 
+void CSSGradientColorStop::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSGradientColorStop> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addInstrumentedMember(m_position);
+    info.addInstrumentedMember(m_color);
+}
+
 PassRefPtr<Image> CSSGradientValue::image(RenderObject* renderer, const IntSize& size)
 {
     if (size.isEmpty())
@@ -452,6 +460,17 @@ bool CSSGradientValue::isCacheable() const
     return true;
 }
 
+void CSSGradientValue::reportBaseClassMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSGradientValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    CSSImageGeneratorValue::reportBaseClassMemoryUsage(memoryObjectInfo);
+    info.addInstrumentedMember(m_firstX);
+    info.addInstrumentedMember(m_firstY);
+    info.addInstrumentedMember(m_secondX);
+    info.addInstrumentedMember(m_secondY);
+    info.addInstrumentedVector(m_stops);
+}
+
 String CSSLinearGradientValue::customCssText() const
 {
     String result;
@@ -594,6 +613,13 @@ PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderObject* render
     return gradient.release();
 }
 
+void CSSLinearGradientValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSLinearGradientValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    CSSGradientValue::reportBaseClassMemoryUsage(memoryObjectInfo);
+    info.addInstrumentedMember(m_angle);
+}
+
 String CSSRadialGradientValue::customCssText() const
 {
     String result;
@@ -891,4 +917,16 @@ PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(RenderObject* render
     return gradient.release();
 }
 
+void CSSRadialGradientValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSRadialGradientValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    CSSGradientValue::reportBaseClassMemoryUsage(memoryObjectInfo);
+    info.addInstrumentedMember(m_firstRadius);
+    info.addInstrumentedMember(m_secondRadius);
+    info.addInstrumentedMember(m_shape);
+    info.addInstrumentedMember(m_sizingBehavior);
+    info.addInstrumentedMember(m_endHorizontalSize);
+    info.addInstrumentedMember(m_endVerticalSize);
+}
+
 } // namespace WebCore
index 0c7ef7764b210b3366fb0c390da44b346349e894..882cc628ffd656feaa1a6d471fecb67f3cfbda5a 100644 (file)
@@ -45,6 +45,7 @@ struct CSSGradientColorStop {
     RefPtr<CSSPrimitiveValue> m_color;
     Color m_resolvedColor;
     bool m_colorIsDerivedFromElement;
+    void reportMemoryUsage(MemoryObjectInfo*) const;
 };
 
 class CSSGradientValue : public CSSImageGeneratorValue {
@@ -105,6 +106,8 @@ protected:
 
     bool isCacheable() const;
 
+    void reportBaseClassMemoryUsage(MemoryObjectInfo*) const;
+
     // Points. Some of these may be null for linear gradients.
     RefPtr<CSSPrimitiveValue> m_firstX;
     RefPtr<CSSPrimitiveValue> m_firstY;
@@ -139,6 +142,8 @@ public:
         return adoptRef(new CSSLinearGradientValue(*this));
     }
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSLinearGradientValue(CSSGradientRepeat repeat, bool deprecatedType = false)
         : CSSGradientValue(LinearGradientClass, repeat, deprecatedType)
@@ -180,6 +185,8 @@ public:
     // Create the gradient for a given size.
     PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&);
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSRadialGradientValue(CSSGradientRepeat repeat, bool deprecatedType = false)
         : CSSGradientValue(RadialGradientClass, repeat, deprecatedType)
index 9be446bd0fb85b064d69f18632699a039a0ac1d6..c2ad501f3cf0d55ab154b6301c9411d1c08ddf25 100644 (file)
@@ -30,6 +30,7 @@
 #include "CSSCrossfadeValue.h"
 #include "CSSGradientValue.h"
 #include "Image.h"
+#include "MemoryInstrumentation.h"
 #include "RenderObject.h"
 #include <wtf/text/WTFString.h>
 
@@ -108,6 +109,14 @@ void CSSImageGeneratorValue::putImage(const IntSize& size, PassRefPtr<Image> ima
     m_images.add(size, image);
 }
 
+void CSSImageGeneratorValue::reportBaseClassMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSImageGeneratorValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addHashCountedSet(m_sizes);
+    info.addHashMap(m_clients);
+    info.addHashMap(m_images); // FIXME: instrument Image
+}
+
 PassRefPtr<Image> CSSImageGeneratorValue::image(RenderObject* renderer, const IntSize& size)
 {
     switch (classType()) {
index b3d84eab283f124a423140cb452d54680a8139bb..cdf405a1cc0b39082696c57f8f7a220600791d9c 100644 (file)
@@ -73,6 +73,8 @@ protected:
     void putImage(const IntSize&, PassRefPtr<Image>);
     const RenderObjectSizeCountMap& clients() const { return m_clients; }
 
+    void reportBaseClassMemoryUsage(MemoryObjectInfo*) const;
+
     HashCountedSet<IntSize> m_sizes; // A count of how many times a given image size is in use.
     RenderObjectSizeCountMap m_clients; // A map from RenderObjects (with entry count) to image sizes.
     HashMap<IntSize, RefPtr<Image> > m_images; // A cache of Image objects by image size.
index 89a64623177ee4eb88f0fe2d803bbc7ab96ecc55..343d9d719179e62435d6ced7adbf8352864edf33 100644 (file)
@@ -32,6 +32,7 @@
 #include "CSSPrimitiveValue.h"
 #include "CachedResourceLoader.h"
 #include "Document.h"
+#include "MemoryInstrumentation.h"
 #include "Page.h"
 #include "StyleCachedImageSet.h"
 #include "StylePendingImage.h"
@@ -162,6 +163,19 @@ PassRefPtr<CSSImageSetValue> CSSImageSetValue::cloneForCSSOM() const
     return adoptRef(new CSSImageSetValue(*this));
 }
 
+void CSSImageSetValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSImageSetValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    CSSValueList::reportDescendantMemoryUsage(memoryObjectInfo);
+    info.addInstrumentedVector(m_imagesInSet);
+}
+
+void CSSImageSetValue::ImageWithScale::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSImageSetValue::ImageWithScale> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addMember(imageURL);
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(CSS_IMAGE_SET)
index 95270a67dfbd46bbd18a54bcba312d744008b9b7..a791d1ea177fbf1c38b6eeb17349595b8f1c03d2 100644 (file)
@@ -58,12 +58,15 @@ public:
     struct ImageWithScale {
         String imageURL;
         float scaleFactor;
+        void reportMemoryUsage(MemoryObjectInfo*) const;
     };
 
     bool hasFailedOrCanceledSubresources() const;
 
     PassRefPtr<CSSImageSetValue> cloneForCSSOM() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 protected:
     ImageWithScale bestImageForScaleFactor();
 
index 07bd4b3e328c0fb22b2945ed78e5d953c5f6b9c3..f6f548536ec2708a4939cc1935fb5348b6325cca 100644 (file)
 #include "CSSCursorImageValue.h"
 #include "CSSParser.h"
 #include "CSSValueKeywords.h"
-#include "Document.h"
-#include "MemoryCache.h"
 #include "CachedImage.h"
 #include "CachedResourceLoader.h"
+#include "Document.h"
+#include "MemoryCache.h"
+#include "MemoryInstrumentation.h"
 #include "StyleCachedImage.h"
 #include "StylePendingImage.h"
 
@@ -125,4 +126,11 @@ PassRefPtr<CSSValue> CSSImageValue::cloneForCSSOM() const
     return uriValue.release();
 }
 
+void CSSImageValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSImageValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addMember(m_url);
+    // No need to report m_image as it is counted as part of RenderArena.
+}
+
 } // namespace WebCore
index 75063d2fa95b84364acde78858a6398ba5a9810d..8c82f2c67db433a751733c9671de9b9151e7a98c 100644 (file)
@@ -48,6 +48,8 @@ public:
 
     bool hasFailedOrCanceledSubresources() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 protected:
     CSSImageValue(ClassType, const String& url);
 
index 8c4be6d4bc700c2b06b1035f72583c75ad891732..2680f2fd6437fd6e4773195e340d4b7741601ee1 100644 (file)
@@ -21,6 +21,7 @@
 #include "config.h"
 #include "CSSInheritedValue.h"
 
+#include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 
 namespace WebCore {
@@ -30,4 +31,9 @@ String CSSInheritedValue::customCssText() const
     return "inherit";
 }
 
+void CSSInheritedValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSInheritedValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+}
+
 } // namespace WebCore
index 5aa906367717304668b1342bb6d17badb167d0e9..68c001f534266a4f7daebb0dee629d357ae9fd49 100644 (file)
@@ -35,6 +35,8 @@ public:
 
     String customCssText() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSInheritedValue()
         : CSSValue(InheritedClass)
index 8de3f3182c5c1eede3acd92010d07e9be819b232..36bd95080eb5d5b9d5c9b0b4db96bc1f6f9e4ba5 100644 (file)
@@ -21,6 +21,7 @@
 #include "config.h"
 #include "CSSInitialValue.h"
 
+#include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 
 namespace WebCore {
@@ -30,4 +31,9 @@ String CSSInitialValue::customCssText() const
     return "initial";
 }
 
+void CSSInitialValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSInitialValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+}
+
 } // namespace WebCore
index dd86d84241a66ff2f737ae9a021a4bbac808b600..d523343d3d3417341313a6ae95c6a669743081ab 100644 (file)
@@ -41,6 +41,8 @@ public:
 
     bool isImplicit() const { return m_isImplicit; }
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSInitialValue(bool implicit)
         : CSSValue(InitialClass)
index 53132eb190f5ea29cc734d0dd5c27945cbfe1bdc..2cffe534c9693e47cba1d8bc5cf7eb3f11fe59b2 100644 (file)
@@ -27,6 +27,7 @@
 #include "CSSLineBoxContainValue.h"
 
 #include "CSSPrimitiveValue.h"
+#include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 
 namespace WebCore {
@@ -72,4 +73,9 @@ String CSSLineBoxContainValue::customCssText() const
     return text;
 }
 
+void CSSLineBoxContainValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSLineBoxContainValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+}
+
 }
index ddc0c60f3c2465afe2372dc3f440dc7140ec527b..eeb6470c83877ec6ef2c8dc0418800f4d4c5dd16 100644 (file)
@@ -50,6 +50,8 @@ public:
 
     LineBoxContain value() const { return m_value; }
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     LineBoxContain m_value;
 
index d5bde82a1b4dd9b42589c1c5d0f4a64d09efbc90..259a505328878cda60f866265175e8555a8c55c6 100644 (file)
@@ -31,6 +31,7 @@
 #include "Color.h"
 #include "Counter.h"
 #include "ExceptionCode.h"
+#include "MemoryInstrumentation.h"
 #include "Node.h"
 #include "Pair.h"
 #include "RGBColor.h"
@@ -1258,4 +1259,48 @@ PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::cloneForCSSOM() const
     return result;
 }
 
+void CSSPrimitiveValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSPrimitiveValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    switch (m_primitiveUnitType) {
+    case CSS_ATTR:
+    case CSS_COUNTER_NAME:
+    case CSS_PARSER_IDENTIFIER:
+    case CSS_PARSER_HEXCOLOR:
+    case CSS_STRING:
+    case CSS_URI:
+#if ENABLE(CSS_VARIABLES)
+    case CSS_VARIABLE_NAME:
+#endif
+        // FIXME: detect other cases when m_value is StringImpl*
+        info.addMember(m_value.string);
+        break;
+    case CSS_COUNTER:
+        info.addMember(m_value.counter);
+        break;
+    case CSS_RECT:
+        info.addMember(m_value.rect);
+        break;
+    case CSS_QUAD:
+        info.addMember(m_value.quad);
+        break;
+    case CSS_PAIR:
+        info.addMember(m_value.pair);
+        break;
+#if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION)
+    case CSS_DASHBOARD_REGION:
+        info.addMember(m_value.region);
+        break;
+#endif
+    case CSS_SHAPE:
+        info.addMember(m_value.shape);
+        break;
+    case CSS_CALC:
+        info.addMember(m_value.calc);
+        break;
+    default:
+        break;
+    }
+}
+
 } // namespace WebCore
index 87069c043339563077686f8673940ee1fc9d7134..fd0832d34780b9694500519420da13eed1f37b78 100644 (file)
@@ -306,6 +306,8 @@ public:
     PassRefPtr<CSSPrimitiveValue> cloneForCSSOM() const;
     void setCSSOMSafe() { m_isCSSOMSafe = true; }
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     // FIXME: int vs. unsigned overloading is too subtle to distinguish the color and identifier cases.
     CSSPrimitiveValue(int ident);
index ab76c32bdaac2ccfc92012047adb5c38f7d2425b..021add2718533838b7ad04314e28868c9beee3bd 100644 (file)
@@ -22,6 +22,7 @@
 #include "CSSProperty.h"
 
 #include "CSSValueList.h"
+#include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 #include "RenderStyleConstants.h"
 #include "StylePropertyShorthand.h"
@@ -694,4 +695,10 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID)
     return false;
 }
 
+void CSSProperty::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSProperty> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addInstrumentedMember(m_value);
+}
+
 } // namespace WebCore
index 712414666bfdea54bc96c1953f1db96040e1d6bc..57a30124f828b16bbd6922d80d8dbfd0c22cf2c4 100644 (file)
@@ -30,6 +30,8 @@
 
 namespace WebCore {
 
+class MemoryObjectInfo;
+
 class CSSProperty {
 public:
     CSSProperty(CSSPropertyID propID, PassRefPtr<CSSValue> value, bool important = false, CSSPropertyID shorthandID = CSSPropertyInvalid, bool implicit = false)
@@ -59,6 +61,8 @@ public:
     static CSSPropertyID resolveDirectionAwareProperty(CSSPropertyID, TextDirection, WritingMode);
     static bool isInheritedProperty(CSSPropertyID);
 
+    void reportMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     // Make sure the following fits in 4 bytes. Really.
     unsigned m_id : 14;
index b36c3ad7b2c212dab6c79ca84bc950016983fd9c..098475273f3267cc8e06ccf576565e0f4d500302 100644 (file)
@@ -27,6 +27,7 @@
 #include "CSSReflectValue.h"
 
 #include "CSSPrimitiveValue.h"
+#include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 
 using namespace std;
@@ -65,4 +66,11 @@ void CSSReflectValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const Sty
         m_mask->addSubresourceStyleURLs(urls, styleSheet);
 }
 
+void CSSReflectValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSReflectValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addInstrumentedMember(m_offset);
+    info.addInstrumentedMember(m_mask);
+}
+
 } // namespace WebCore
index 5cfb20e27f758840619412580bc034fea57a69ef..1bdfd5fe76c7ef281f7f7789b29ceaa448c73bd9 100644 (file)
@@ -51,6 +51,8 @@ public:
 
     void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*) const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSReflectValue(CSSReflectionDirection direction, PassRefPtr<CSSPrimitiveValue> offset, PassRefPtr<CSSValue> mask)
         : CSSValue(ReflectClass)
index dcf7bb29b546c684bd96c7cf6aa1768de4ea1010..fe8278abc171d85180023173a0c580ef05eac5b2 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "CSSTimingFunctionValue.h"
 
+#include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 
 namespace WebCore {
@@ -35,6 +36,11 @@ String CSSLinearTimingFunctionValue::customCssText() const
     return "linear";
 }
 
+void CSSLinearTimingFunctionValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSLinearTimingFunctionValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+}
+
 String CSSCubicBezierTimingFunctionValue::customCssText() const
 {
     String text("cubic-bezier(");
@@ -49,6 +55,11 @@ String CSSCubicBezierTimingFunctionValue::customCssText() const
     return text;
 }
 
+void CSSCubicBezierTimingFunctionValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSCubicBezierTimingFunctionValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+}
+
 String CSSStepsTimingFunctionValue::customCssText() const
 {
     String text("steps(");
@@ -59,4 +70,9 @@ String CSSStepsTimingFunctionValue::customCssText() const
     return text;
 }
 
+void CSSStepsTimingFunctionValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSStepsTimingFunctionValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+}
+
 } // namespace WebCore
index e544c5ff00c0d6fc3197f4685a8a15213db458a0..3eb4b2295ab976392fddf2e50c29fdc26be50d42 100644 (file)
@@ -40,6 +40,8 @@ public:
 
     String customCssText() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSLinearTimingFunctionValue()
         : CSSValue(LinearTimingFunctionClass)
@@ -61,6 +63,8 @@ public:
     double x2() const { return m_x2; }
     double y2() const { return m_y2; }
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSCubicBezierTimingFunctionValue(double x1, double y1, double x2, double y2)
         : CSSValue(CubicBezierTimingFunctionClass)
@@ -89,6 +93,8 @@ public:
 
     String customCssText() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSStepsTimingFunctionValue(int steps, bool stepAtStart)
         : CSSValue(StepsTimingFunctionClass)
index 2c2c44d27ab568c6c46be33e5629615550a0fad3..9b0c95d9336af6016bc0df7bb5acd9721838f238 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "CSSUnicodeRangeValue.h"
 
+#include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 
 namespace WebCore {
@@ -37,4 +38,9 @@ String CSSUnicodeRangeValue::customCssText() const
     return result;
 }
 
+void CSSUnicodeRangeValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSUnicodeRangeValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+}
+
 }
index 4fe1db77cb32669150cde50797f41c353f9b676b..d50f5b6815c7b76deba0501f96844c2dcf160f66 100644 (file)
@@ -44,6 +44,8 @@ public:
 
     String customCssText() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     CSSUnicodeRangeValue(UChar32 from, UChar32 to)
         : CSSValue(UnicodeRangeClass)
index 5ffb1567e88588da75566cf85f94562d909ce947..9912baf9b0058658f9a2e3227262ac40e79eb42e 100644 (file)
@@ -52,6 +52,7 @@
 #endif
 #include "FontValue.h"
 #include "FontFeatureValue.h"
+#include "MemoryInstrumentation.h"
 #include "ShadowValue.h"
 #include "SVGColor.h"
 #include "SVGPaint.h"
@@ -77,6 +78,12 @@ public:
 
     String cssText() const { return m_cssText; }
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+    {
+        MemoryClassInfo<TextCloneCSSValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+        info.addMember(m_cssText);
+    }
+
 private:
     TextCloneCSSValue(ClassType classType, const String& text) 
         : CSSValue(classType, /*isCSSOMSafe*/ true)
@@ -141,6 +148,126 @@ bool CSSValue::hasFailedOrCanceledSubresources() const
     return false;
 }
 
+void CSSValue::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    if (m_isTextClone) {
+        ASSERT(isCSSOMSafe());
+        static_cast<const TextCloneCSSValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    }
+
+    ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());
+    switch (classType()) {
+    case PrimitiveClass:
+        static_cast<const CSSPrimitiveValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case ImageClass:
+        static_cast<const CSSImageValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case CursorImageClass:
+        static_cast<const CSSCursorImageValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case CanvasClass:
+        static_cast<const CSSCanvasValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case CrossfadeClass:
+        static_cast<const CSSCrossfadeValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case LinearGradientClass:
+        static_cast<const CSSLinearGradientValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case RadialGradientClass:
+        static_cast<const CSSRadialGradientValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case CubicBezierTimingFunctionClass:
+        static_cast<const CSSCubicBezierTimingFunctionValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case LinearTimingFunctionClass:
+        static_cast<const CSSLinearTimingFunctionValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case StepsTimingFunctionClass:
+        static_cast<const CSSStepsTimingFunctionValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case AspectRatioClass:
+        static_cast<const CSSAspectRatioValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case BorderImageSliceClass:
+        static_cast<const CSSBorderImageSliceValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case FontFeatureClass:
+        static_cast<const FontFeatureValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case FontClass:
+        static_cast<const FontValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case FontFaceSrcClass:
+        static_cast<const CSSFontFaceSrcValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case FunctionClass:
+        static_cast<const CSSFunctionValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case InheritedClass:
+        static_cast<const CSSInheritedValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case InitialClass:
+        static_cast<const CSSInitialValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case ReflectClass:
+        static_cast<const CSSReflectValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case ShadowClass:
+        static_cast<const ShadowValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case UnicodeRangeClass:
+        static_cast<const CSSUnicodeRangeValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case LineBoxContainClass:
+        static_cast<const CSSLineBoxContainValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case CalculationClass:
+        static_cast<const CSSCalcValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+#if ENABLE(CSS_FILTERS) && ENABLE(CSS_SHADERS)
+    case WebKitCSSShaderClass:
+        static_cast<const WebKitCSSShaderValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+#endif
+#if ENABLE(CSS_VARIABLES)
+    case VariableClass:
+        static_cast<const CSSVariableValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+#endif
+#if ENABLE(SVG)
+    case SVGColorClass:
+        static_cast<const SVGColor*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case SVGPaintClass:
+        static_cast<const SVGPaint*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    case WebKitCSSSVGDocumentClass:
+        static_cast<const WebKitCSSSVGDocumentValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+#endif
+    case ValueListClass:
+        static_cast<const CSSValueList*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+#if ENABLE(CSS_IMAGE_SET)
+    case ImageSetClass:
+        static_cast<const CSSImageSetValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+#endif
+#if ENABLE(CSS_FILTERS)
+    case WebKitCSSFilterClass:
+        static_cast<const WebKitCSSFilterValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+#endif
+    case WebKitCSSTransformClass:
+        static_cast<const WebKitCSSTransformValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+    }
+    ASSERT_NOT_REACHED();
+}
+
 String CSSValue::cssText() const
 {
     if (m_isTextClone) {
index 83c2e8e5566366c2cb18c606a5407754ea00db0b..0572e2c12b03fb2b2e848d345a350fc39ffd0fbb 100644 (file)
@@ -29,6 +29,7 @@
 
 namespace WebCore {
 
+class MemoryObjectInfo;
 class StyleSheetContents;
     
 // FIXME: The current CSSValue and subclasses should be turned into internal types (StyleValue).
@@ -119,6 +120,8 @@ public:
 
     bool hasFailedOrCanceledSubresources() const;
 
+    void reportMemoryUsage(MemoryObjectInfo*) const;
+
 protected:
 
     static const size_t ClassTypeBits = 5;
index b8d36a419a56a7439d43a4a83d3d061b0ddaf299..2ef3d516d3e206c357df5ec23ac58787ba0d7d87 100644 (file)
@@ -22,6 +22,7 @@
 #include "CSSValueList.h"
 
 #include "CSSParserValues.h"
+#include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 #include <wtf/PassOwnPtr.h>
 #include <wtf/text/StringBuilder.h>
@@ -196,4 +197,10 @@ PassRefPtr<CSSValueList> CSSValueList::cloneForCSSOM() const
     return adoptRef(new CSSValueList(*this));
 }
 
+void CSSValueList::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<CSSValueList> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addInstrumentedVector(m_values);
+}
+
 } // namespace WebCore
index 40bb43795fa8d465e0326cd0dc01ae8e12b2f942..e988d6c2e4dd7d2ebe7c38d711cfc7f632d51461 100644 (file)
@@ -69,6 +69,8 @@ public:
     
     PassRefPtr<CSSValueList> cloneForCSSOM() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 protected:
     CSSValueList(ClassType, ValueListSeparator);
     CSSValueList(const CSSValueList& cloneFrom);
index 2c5b66a6b943c899d7653cc93135987b2fec49de..93e0aa6b6f00e0c85ce6e9f9d7cc9e334d9807b1 100644 (file)
@@ -34,6 +34,7 @@
 #include "CSSParserValues.h"
 #include "CSSPropertyNames.h"
 #include "CSSValue.h"
+#include "MemoryInstrumentation.h"
 
 namespace WebCore {
 
@@ -47,6 +48,13 @@ public:
     const AtomicString& name() const { return m_name; }
     const String& value() const { return m_value; }
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+    {
+        MemoryClassInfo<CSSVariableValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+        info.addMember(m_name);
+        info.addMember(m_value);
+    }
+
 private:
     CSSVariableValue(const AtomicString& name, const String& value)
         : CSSValue(VariableClass)
index 62c396068598af91580f55e5a94a868aa51bf32c..69f542f148e5d185c915e3afa05f995a86c9f2d9 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "CSSParser.h"
 #include "CSSValueKeywords.h"
+#include "MemoryInstrumentation.h"
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -49,4 +50,10 @@ String FontFeatureValue::customCssText() const
     return builder.toString();
 }
 
+void FontFeatureValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<FontFeatureValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addMember(m_tag);
+}
+
 }
index 7d5e036c08a618395855672750a61e547ad5c5eb..28d89f42369b08beb14165b9abea6affc3980edd 100644 (file)
@@ -42,6 +42,8 @@ public:
     int value() const { return m_value; }
     String customCssText() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     FontFeatureValue(const String&, int);
 
index 8841a79935e2e5a3341a9f345a066435a02d5155..656c7d8230c44f2532b6e3ce73ca6dc19420dec2 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "CSSValueList.h"
 #include "CSSPrimitiveValue.h"
+#include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 #include <wtf/text/StringBuilder.h>
 
@@ -65,4 +66,15 @@ String FontValue::customCssText() const
     return result.toString();
 }
 
+void FontValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<FontValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addInstrumentedMember(style);
+    info.addInstrumentedMember(variant);
+    info.addInstrumentedMember(weight);
+    info.addInstrumentedMember(size);
+    info.addInstrumentedMember(lineHeight);
+    info.addInstrumentedMember(family);
+}
+
 }
index 5f8336921055c398b152c7cb0357cbc7e77ed93a..03a61268a587470fcb8a2112a9f0bc9d0aae8469 100644 (file)
@@ -39,6 +39,8 @@ public:
 
     String customCssText() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
     RefPtr<CSSPrimitiveValue> style;
     RefPtr<CSSPrimitiveValue> variant;
     RefPtr<CSSPrimitiveValue> weight;
index 03904204c2311664cc3d6b99cd3d262f50cc00eb..c269c3b164a0b18df2e73c827b8287654bb93b4a 100644 (file)
@@ -114,6 +114,7 @@ void MediaQueryExp::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     MemoryClassInfo<MediaQueryExp> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
     info.addMember(m_mediaFeature);
     info.addMember(m_serializationCache);
+    info.addInstrumentedMember(m_value);
 }
 
 } // namespace
index 8a248594d6231c3b0d353f2341ed1037ae447b06..73a4332e8a9d1f41113621c56e5a2285bc06a34d 100644 (file)
@@ -135,7 +135,8 @@ void PropertySetCSSStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryO
 {
     MemoryClassInfo<PropertySetCSSStyleDeclaration> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
     info.addInstrumentedMember(m_propertySet);
-    // FIXME: add info.addInstrumentedHasMap(m_cssomCSSValueClones) when CSSValue is instrumented.
+    if (m_cssomCSSValueClones)
+        info.addInstrumentedMapEntries(*m_cssomCSSValueClones);
 }
 
 unsigned PropertySetCSSStyleDeclaration::length() const
index 14c7cda8c570bcbd7fb756fb5ef9b9baf9013bb4..db646692eaae624edce4bfcc1ef8388392e97d16 100644 (file)
@@ -21,6 +21,7 @@
 #include "ShadowValue.h"
 
 #include "CSSPrimitiveValue.h"
+#include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 
 namespace WebCore {
@@ -77,4 +78,15 @@ String ShadowValue::customCssText() const
     return text;
 }
 
+void ShadowValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<ShadowValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addInstrumentedMember(x);
+    info.addInstrumentedMember(y);
+    info.addInstrumentedMember(blur);
+    info.addInstrumentedMember(spread);
+    info.addInstrumentedMember(style);
+    info.addInstrumentedMember(color);
+}
+
 }
index 21547a5711ee3ee8f54b5cd9f5fa8b6596f4293f..f2d8e6f6f98bf6fff614bc3504562da232d00cd8 100644 (file)
@@ -44,6 +44,8 @@ public:
 
     String customCssText() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
     RefPtr<CSSPrimitiveValue> x;
     RefPtr<CSSPrimitiveValue> y;
     RefPtr<CSSPrimitiveValue> blur;
index 1e78aab66e53b2ce83a072b5041f5f7cc3f614cb..37d3971b41338850fb841ca1dbdae6c018b98eed 100644 (file)
@@ -1092,6 +1092,9 @@ void StylePropertySet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
         info.addVectorPtr(m_mutablePropertyVector);
     else
         info.addRawBuffer(m_properties, m_arraySize * sizeof(CSSProperty));
+    unsigned count = propertyCount();
+    for (unsigned i = 0; i < count; ++i)
+        info.addInstrumentedMember(propertyAt(i));
 }
 
 // See the function above if you need to update this.
index adca8db620be62999ff9bd9d6ed056eba32c269f..389dc1b36a2f1e1926c6a3b4a5979be430277f5f 100644 (file)
@@ -5637,6 +5637,24 @@ void StyleResolver::loadPendingResources()
 #endif
 }
 
+void StyleResolver::MatchedProperties::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<StyleResolver::MatchedProperties> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addInstrumentedMember(properties);
+}
+
+void StyleResolver::MatchedPropertiesCacheItem::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<StyleResolver::MatchedPropertiesCacheItem> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addInstrumentedVector(matchedProperties);
+}
+
+void MediaQueryResult::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<MediaQueryResult> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addInstrumentedMember(m_expression);
+}
+
 void StyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo<StyleResolver> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
@@ -5647,18 +5665,23 @@ void StyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.addInstrumentedMember(m_uncommonAttributeRuleSet);
     info.addHashMap(m_keyframesRuleMap);
     info.addHashMap(m_matchedPropertiesCache);
+    info.addInstrumentedMapValues(m_matchedPropertiesCache);
     info.addVector(m_matchedRules);
 
-    // FIXME: Instrument StaticCSSRuleList and add m_ruleList here.
+    info.addInstrumentedMember(m_ruleList);
     info.addHashMap(m_pendingImageProperties);
-    info.addVector(m_viewportDependentMediaQueryResults);
+    info.addInstrumentedMapValues(m_pendingImageProperties);
+    info.addInstrumentedMember(m_lineHeightValue);
+    info.addInstrumentedVector(m_viewportDependentMediaQueryResults);
     info.addHashMap(m_styleRuleToCSSOMWrapperMap);
-    info.addHashSet(m_styleSheetCSSOMWrapperSet);
+    info.addInstrumentedMapEntries(m_styleRuleToCSSOMWrapperMap);
+    info.addInstrumentedHashSet(m_styleSheetCSSOMWrapperSet);
 #if ENABLE(CSS_FILTERS) && ENABLE(SVG)
     info.addHashMap(m_pendingSVGDocuments);
 #endif
 #if ENABLE(STYLE_SCOPED)
     info.addHashMap(m_scopedAuthorStyles);
+    info.addInstrumentedMapEntries(m_scopedAuthorStyles);
     info.addVector(m_scopeStack);
 #endif
 
index d12c7b15f960408a909f7cb583fd595726ae22e6..472efc9ea6fcc7a349a4cf09bf577ea121fd829b 100644 (file)
@@ -102,6 +102,7 @@ public:
         , m_result(result)
     {
     }
+    void reportMemoryUsage(MemoryObjectInfo*) const;
 
     MediaQueryExp m_expression;
     bool m_result;
@@ -320,6 +321,7 @@ private:
 
     struct MatchedProperties {
         MatchedProperties() : possiblyPaddedMember(0) { }
+        void reportMemoryUsage(MemoryObjectInfo*) const;
         
         RefPtr<StylePropertySet> properties;
         union {
@@ -447,6 +449,7 @@ private:
 
     static unsigned computeMatchedPropertiesHash(const MatchedProperties*, unsigned size);
     struct MatchedPropertiesCacheItem {
+        void reportMemoryUsage(MemoryObjectInfo*) const;
         Vector<MatchedProperties> matchedProperties;
         MatchRanges ranges;
         RefPtr<RenderStyle> renderStyle;
index 2916dc2d153bf3e244bcf64091259fe432e020ee..71d7b9f9fbc38112844ace553686bb85c5c8988e 100644 (file)
@@ -29,6 +29,7 @@
 #if ENABLE(CSS_FILTERS)
 
 #include "CSSValueList.h"
+#include "MemoryInstrumentation.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
@@ -110,6 +111,12 @@ PassRefPtr<WebKitCSSFilterValue> WebKitCSSFilterValue::cloneForCSSOM() const
     return adoptRef(new WebKitCSSFilterValue(*this));
 }
 
+void WebKitCSSFilterValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<WebKitCSSFilterValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    CSSValueList::reportDescendantMemoryUsage(memoryObjectInfo);
+}
+
 }
 
 #endif // ENABLE(CSS_FILTERS)
index a34d5745c65c96773e16ce073b218b9dc8d14b8f..08b3e9f9a5029a81d578583d964d58317b2dff26 100644 (file)
@@ -68,6 +68,8 @@ public:
 
     PassRefPtr<WebKitCSSFilterValue> cloneForCSSOM() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     WebKitCSSFilterValue(FilterOperationType);
     WebKitCSSFilterValue(const WebKitCSSFilterValue& cloneFrom);
index 4902504966ac32cbcc72f010e7d52989d17ad704..df41b8d40b546a9939c058e748a817029438b7b0 100644 (file)
@@ -30,6 +30,7 @@
 #include "CSSParser.h"
 #include "CachedResourceLoader.h"
 #include "Document.h"
+#include "MemoryInstrumentation.h"
 
 namespace WebCore {
 
@@ -63,6 +64,13 @@ String WebKitCSSSVGDocumentValue::customCssText() const
     return quoteCSSStringIfNeeded(m_url);
 }
 
+void WebKitCSSSVGDocumentValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<WebKitCSSSVGDocumentValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addMember(m_url);
+    // FIXME: add m_document when cached resources are instrumented.
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(SVG)
index cb03f56ee5c3ec4a078b53189e77557505f8d738..96bcc8c30c49601b672c1875c6d20224230e57cd 100644 (file)
@@ -45,6 +45,8 @@ public:
     const String& url() const { return m_url; }
     bool loadRequested() const { return m_loadRequested; }
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     WebKitCSSSVGDocumentValue(const String& url);
 
index 8651758ed6c9917f022491715e6bd556b69c5267..5ca7733b6a6d8be265e4a8a4274cedfe820a09c9 100644 (file)
@@ -35,6 +35,7 @@
 #include "CachedResourceLoader.h"
 #include "CSSParser.h"
 #include "Document.h"
+#include "MemoryInstrumentation.h"
 #include "StyleCachedShader.h"
 #include "StylePendingShader.h"
 
@@ -79,6 +80,12 @@ String WebKitCSSShaderValue::customCssText() const
     return "url(" + quoteCSSURLIfNeeded(m_url) + ")";
 }
 
+void WebKitCSSShaderValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<WebKitCSSShaderValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addMember(m_url);
+}
+    
 } // namespace WebCore
 
 #endif // ENABLE(CSS_SHADERS)
index fd95bc63cf7ac509ce359d09b8fbc90e319b14b4..c43201ca2a4a164ab9363d79462e42754c2fc2ca 100644 (file)
@@ -50,6 +50,8 @@ public:
 
     String customCssText() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     WebKitCSSShaderValue(const String& url);
 
index 87ded7da6b56627d507e1cb05cb3060da8002a9b..1cb73fc09d409bf772cd7b46f406d975df639212 100644 (file)
@@ -27,6 +27,7 @@
 #include "WebKitCSSTransformValue.h"
 
 #include "CSSValueList.h"
+#include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/StringBuilder.h>
@@ -104,4 +105,10 @@ PassRefPtr<WebKitCSSTransformValue> WebKitCSSTransformValue::cloneForCSSOM() con
     return adoptRef(new WebKitCSSTransformValue(*this));
 }
 
+void WebKitCSSTransformValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<WebKitCSSTransformValue> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    CSSValueList::reportDescendantMemoryUsage(memoryObjectInfo);
+}
+
 }
index 5fc4f7d6bfd5d4d676bad1d082d6b45d949b9792..fd117f23294bda52182b23ae6056b3b73d918d10 100644 (file)
@@ -74,6 +74,8 @@ public:
     
     PassRefPtr<WebKitCSSTransformValue> cloneForCSSOM() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     WebKitCSSTransformValue(TransformOperationType);
     WebKitCSSTransformValue(const WebKitCSSTransformValue& cloneFrom);
index 7dca5bed9dd985815550325e111a78c1140edf08..299e614faed61484a0b125a2f77a22ff32e47cca 100644 (file)
@@ -38,9 +38,14 @@ namespace WebCore {
 
 void MemoryInstrumentation::addObject(const String& string, ObjectType objectType)
 {
-    if (string.isNull() || visited(string.impl()))
+    addObject(string.impl(), objectType);
+}
+
+void MemoryInstrumentation::addObject(const StringImpl* stringImpl, ObjectType objectType)
+{
+    if (!stringImpl || visited(stringImpl))
         return;
-    countObjectSize(objectType, string.impl()->sizeInBytes());
+    countObjectSize(objectType, stringImpl->sizeInBytes());
 }
 
 } // namespace WebCore
index 8834d37689229c9ad0befa36427ee08595f19fe3..6a8ec45a80d47097e0d892e7844abbffb55e5019 100644 (file)
@@ -102,11 +102,13 @@ private:
         OwningTraits<T>::addObject(this, t, ownerObjectType);
     }
     void addObject(const String&, ObjectType);
+    void addObject(const StringImpl*, ObjectType);
     template <typename T> void addInstrumentedObject(const T& t, ObjectType ownerObjectType) { OwningTraits<T>::addInstrumentedObject(this, t, ownerObjectType); }
-
     template <typename HashMapType> void addHashMap(const HashMapType&, ObjectType, bool contentOnly = false);
     template <typename HashSetType> void addHashSet(const HashSetType&, ObjectType, bool contentOnly = false);
     template <typename CollectionType> void addInstrumentedCollection(const CollectionType&, ObjectType, bool contentOnly = false);
+    template <typename MapType> void addInstrumentedMapEntries(const MapType&, ObjectType);
+    template <typename MapType> void addInstrumentedMapValues(const MapType&, ObjectType);
     template <typename ListHashSetType> void addListHashSet(const ListHashSetType&, ObjectType, bool contentOnly = false);
     template <typename VectorType> void addVector(const VectorType&, ObjectType, bool contentOnly = false);
     void addRawBuffer(const void* const& buffer, ObjectType ownerObjectType, size_t size)
@@ -190,10 +192,13 @@ public:
 
     template <typename HashMapType> void addHashMap(const HashMapType& map) { m_memoryInstrumentation->addHashMap(map, m_objectType, true); }
     template <typename HashSetType> void addHashSet(const HashSetType& set) { m_memoryInstrumentation->addHashSet(set, m_objectType, true); }
+    template <typename HashSetType> void addHashCountedSet(const HashSetType& set) { m_memoryInstrumentation->addHashSet(set, m_objectType, true); }
     template <typename HashSetType> void addInstrumentedHashSet(const HashSetType& set) { m_memoryInstrumentation->addInstrumentedCollection(set, m_objectType, true); }
     template <typename VectorType> void addInstrumentedVector(const VectorType& vector) { m_memoryInstrumentation->addInstrumentedCollection(vector, m_objectType, true); }
     template <typename VectorType> void addInstrumentedVectorPtr(const OwnPtr<VectorType>& vector) { m_memoryInstrumentation->addInstrumentedCollection(*vector, m_objectType, false); }
     template <typename VectorType> void addInstrumentedVectorPtr(const VectorType* const& vector) { m_memoryInstrumentation->addInstrumentedCollection(*vector, m_objectType, false); }
+    template <typename MapType> void addInstrumentedMapEntries(const MapType& map) { m_memoryInstrumentation->addInstrumentedMapEntries(map, m_objectType); }
+    template <typename MapType> void addInstrumentedMapValues(const MapType& map) { m_memoryInstrumentation->addInstrumentedMapValues(map, m_objectType); }
     template <typename ListHashSetType> void addListHashSet(const ListHashSetType& set) { m_memoryInstrumentation->addListHashSet(set, m_objectType, true); }
     template <typename VectorType> void addVector(const VectorType& vector) { m_memoryInstrumentation->addVector(vector, m_objectType, true); }
     template <typename VectorType> void addVectorPtr(const VectorType* const vector) { m_memoryInstrumentation->addVector(*vector, m_objectType, false); }
@@ -201,6 +206,7 @@ public:
 
     void addMember(const String& string) { m_memoryInstrumentation->addObject(string, m_objectType); }
     void addMember(const AtomicString& string) { m_memoryInstrumentation->addObject((const String&)string, m_objectType); }
+    void addMember(const StringImpl* string) { m_memoryInstrumentation->addObject(string, m_objectType); }
 
 private:
     MemoryObjectInfo* m_memoryObjectInfo;
@@ -306,6 +312,24 @@ void MemoryInstrumentation::addInstrumentedCollection(const CollectionType& coll
         addInstrumentedObject(*i, ownerObjectType);
 }
 
+template <typename MapType>
+void MemoryInstrumentation::addInstrumentedMapEntries(const MapType& map, ObjectType ownerObjectType)
+{
+    typename MapType::const_iterator end = map.end();
+    for (typename MapType::const_iterator i = map.begin(); i != end; ++i) {
+        addInstrumentedObject(i->first, ownerObjectType);
+        addInstrumentedObject(i->second, ownerObjectType);
+    }
+}
+
+template <typename MapType>
+void MemoryInstrumentation::addInstrumentedMapValues(const MapType& map, ObjectType ownerObjectType)
+{
+    typename MapType::const_iterator end = map.end();
+    for (typename MapType::const_iterator i = map.begin(); i != end; ++i)
+        addInstrumentedObject(i->second, ownerObjectType);
+}
+
 template<typename ListHashSetType>
 void MemoryInstrumentation::addListHashSet(const ListHashSetType& hashSet, ObjectType ownerObjectType, bool contentOnly)
 {
index 2572b7bbfe29fc216b8ae8a69c3cb4d2e87a31ad..0eded611c8f8aabea442f01463bd02420ea472f5 100644 (file)
@@ -25,6 +25,7 @@
 #include "SVGColor.h"
 
 #include "CSSParser.h"
+#include "MemoryInstrumentation.h"
 #include "RGBColor.h"
 #include "SVGException.h"
 
@@ -104,6 +105,11 @@ PassRefPtr<SVGColor> SVGColor::cloneForCSSOM() const
     return adoptRef(new SVGColor(SVGColorClass, *this));
 }
 
+void SVGColor::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<SVGColor> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+}
+
 }
 
 #endif // ENABLE(SVG)
index cffac5385e21519c628815ac93216a6333508974..7dddcd7a9444b11cd856549a32495bff1e90dc5a 100644 (file)
@@ -75,6 +75,8 @@ public:
     
     PassRefPtr<SVGColor> cloneForCSSOM() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 protected:
     friend class CSSComputedStyleDeclaration;
 
index 8cf3d7e56822eace1ac13b2fec284ed8ef73a8e0..9c655b3cef6f05480532340f3cc002cadcfce18e 100644 (file)
@@ -24,6 +24,7 @@
 #if ENABLE(SVG)
 #include "SVGPaint.h"
 
+#include "MemoryInstrumentation.h"
 #include "SVGException.h"
 #include "SVGURIReference.h"
 #include <wtf/text/WTFString.h>
@@ -111,6 +112,12 @@ PassRefPtr<SVGPaint> SVGPaint::cloneForCSSOM() const
     return adoptRef(new SVGPaint(*this));
 }
 
+void SVGPaint::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<SVGPaint> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+    info.addMember(m_uri);
+}
+
 }
 
 #endif // ENABLE(SVG)
index b053cbd7778c7a1902aefa5d6ee09de87f8b3b93..ac5675b59ede0c9b90f71da3c8e62c7ee97ede7d 100644 (file)
@@ -95,6 +95,8 @@ public:
 
     PassRefPtr<SVGPaint> cloneForCSSOM() const;
 
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
 private:
     friend class CSSComputedStyleDeclaration;