Diff
Modified: trunk/Source/WebCore/ChangeLog (124588 => 124589)
--- trunk/Source/WebCore/ChangeLog 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/ChangeLog 2012-08-03 10:18:31 UTC (rev 124589)
@@ -1,3 +1,107 @@
+2012-08-03 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: add CSSRule memory instrumentation
+ https://bugs.webkit.org/show_bug.cgi?id=92962
+
+ Reviewed by Pavel Feldman.
+
+ Added memory footprint reporting method to CSSRule and its descendants.
+
+ * css/CSSCharsetRule.cpp:
+ (WebCore::CSSCharsetRule::reportDescendantMemoryUsage):
+ (WebCore):
+ * css/CSSCharsetRule.h:
+ (CSSCharsetRule):
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::CSSComputedStyleDeclaration::reportMemoryUsage):
+ (WebCore):
+ * css/CSSComputedStyleDeclaration.h:
+ (CSSComputedStyleDeclaration):
+ * css/CSSFontFaceRule.cpp:
+ (WebCore::CSSFontFaceRule::reportDescendantMemoryUsage):
+ (WebCore):
+ * css/CSSFontFaceRule.h:
+ (CSSFontFaceRule):
+ * css/CSSImportRule.cpp:
+ (WebCore::CSSImportRule::reportDescendantMemoryUsage):
+ (WebCore):
+ * css/CSSImportRule.h:
+ (CSSImportRule):
+ * css/CSSMediaRule.cpp:
+ (WebCore::CSSMediaRule::reportDescendantMemoryUsage):
+ (WebCore):
+ * css/CSSMediaRule.h:
+ (CSSMediaRule):
+ * css/CSSPageRule.cpp:
+ (WebCore::CSSPageRule::reportDescendantMemoryUsage):
+ (WebCore):
+ * css/CSSPageRule.h:
+ (CSSPageRule):
+ * css/CSSRule.cpp:
+ (WebCore::CSSRule::reportMemoryUsage): we manually implement polymorphic
+ call here to avoid adding vtable pointer to all CSSRule objects. Descendants
+ are expected to report their memory via reportDescendantMemoryUsage. The name
+ is intentionally different from reportMemoryUsage to avoid accidential infitite
+ recursion: if the descendants overrode non-virtual CSSRule::reportMemoryUsage,
+ it would be easy to add a new descendant type to the switch in
+ CSSRule::reportMemoryUsage without providing proper override for reportMemoryUsage
+ and CSSRule::reportMemoryUsage would end up calling itself.
+ (WebCore):
+ (WebCore::CSSRule::reportBaseClassMemoryUsage): again we cannot use
+ MemoryClassInfo::visitBaseClass like we do for virtual methods because it would
+ lead to a recursive call of CSSRule::reportMemoryUsage. This is why we use
+ reportBaseClassMemoryUsage to allow descendants to report objects referenced
+ from their base class.
+ * css/CSSRule.h:
+ (WebCore):
+ (CSSRule):
+ * css/CSSRuleList.cpp:
+ (WebCore::StaticCSSRuleList::reportMemoryUsage):
+ (WebCore):
+ * css/CSSRuleList.h:
+ (WebCore):
+ (CSSRuleList):
+ (StaticCSSRuleList):
+ (LiveCSSRuleList):
+ * css/CSSStyleDeclaration.h:
+ (WebCore):
+ (CSSStyleDeclaration):
+ * css/CSSStyleRule.cpp:
+ (WebCore::CSSStyleRule::reportDescendantMemoryUsage):
+ (WebCore):
+ * css/CSSStyleRule.h:
+ (CSSStyleRule):
+ * css/CSSStyleSheet.cpp:
+ (StyleSheetCSSRuleList):
+ (WebCore::CSSStyleSheet::reportMemoryUsage):
+ * css/CSSUnknownRule.h:
+ (CSSUnknownRule):
+ (WebCore::CSSUnknownRule::reportDescendantMemoryUsage):
+ * css/PropertySetCSSStyleDeclaration.cpp:
+ (WebCore::PropertySetCSSStyleDeclaration::reportMemoryUsage):
+ (WebCore):
+ (WebCore::StyleRuleCSSStyleDeclaration::reportMemoryUsage):
+ (WebCore::InlineCSSStyleDeclaration::reportMemoryUsage):
+ * css/PropertySetCSSStyleDeclaration.h:
+ (PropertySetCSSStyleDeclaration):
+ (StyleRuleCSSStyleDeclaration):
+ (InlineCSSStyleDeclaration):
+ * css/WebKitCSSKeyframeRule.cpp:
+ (WebCore::WebKitCSSKeyframeRule::reportDescendantMemoryUsage):
+ (WebCore):
+ * css/WebKitCSSKeyframeRule.h:
+ (WebKitCSSKeyframeRule):
+ * css/WebKitCSSKeyframesRule.cpp:
+ (WebCore::WebKitCSSKeyframesRule::reportDescendantMemoryUsage):
+ (WebCore):
+ * css/WebKitCSSKeyframesRule.h:
+ (WebKitCSSKeyframesRule):
+ * css/WebKitCSSRegionRule.cpp:
+ (WebCore::WebKitCSSRegionRule::reportDescendantMemoryUsage):
+ (WebCore):
+ * css/WebKitCSSRegionRule.h:
+ (WebKitCSSRegionRule):
+
2012-08-03 Adam Barth <[email protected]>
WebCore::DragController::cleanupAfterSystemDrag should null-check page
Modified: trunk/Source/WebCore/css/CSSCharsetRule.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/CSSCharsetRule.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSCharsetRule.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -21,6 +21,8 @@
#include "config.h"
#include "CSSCharsetRule.h"
+#include "MemoryInstrumentation.h"
+
namespace WebCore {
CSSCharsetRule::CSSCharsetRule(CSSStyleSheet* parent, const String& encoding)
@@ -34,4 +36,11 @@
return "@charset \"" + m_encoding + "\";";
}
+void CSSCharsetRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<CSSCharsetRule> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
+ info.addString(m_encoding);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSCharsetRule.h (124588 => 124589)
--- trunk/Source/WebCore/css/CSSCharsetRule.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSCharsetRule.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -39,6 +39,8 @@
String cssText() const;
+ void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
private:
CSSCharsetRule(CSSStyleSheet* parent, const String& encoding);
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -46,6 +46,7 @@
#include "FontFeatureSettings.h"
#include "FontFeatureValue.h"
#include "FontValue.h"
+#include "MemoryInstrumentation.h"
#include "Pair.h"
#include "Rect.h"
#include "RenderBox.h"
@@ -2684,6 +2685,12 @@
return StylePropertySet::create(list.data(), list.size());
}
+void CSSComputedStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<CSSComputedStyleDeclaration> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ info.addInstrumentedMember(m_node);
+}
+
CSSRule* CSSComputedStyleDeclaration::parentRule() const
{
return 0;
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h (124588 => 124589)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -72,6 +72,8 @@
PassRefPtr<StylePropertySet> copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const;
+ virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+
private:
CSSComputedStyleDeclaration(PassRefPtr<Node>, bool allowVisitedStyle, const String&);
Modified: trunk/Source/WebCore/css/CSSFontFaceRule.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/CSSFontFaceRule.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSFontFaceRule.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -22,6 +22,7 @@
#include "config.h"
#include "CSSFontFaceRule.h"
+#include "MemoryInstrumentation.h"
#include "StylePropertySet.h"
#include "StyleRule.h"
@@ -63,4 +64,12 @@
m_propertiesCSSOMWrapper->reattach(m_fontFaceRule->mutableProperties());
}
+void CSSFontFaceRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<CSSFontFaceRule> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
+ info.addInstrumentedMember(m_fontFaceRule);
+ info.addInstrumentedMember(m_propertiesCSSOMWrapper);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSFontFaceRule.h (124588 => 124589)
--- trunk/Source/WebCore/css/CSSFontFaceRule.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSFontFaceRule.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -45,6 +45,8 @@
void reattach(StyleRuleFontFace*);
+ void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
private:
CSSFontFaceRule(StyleRuleFontFace*, CSSStyleSheet* parent);
Modified: trunk/Source/WebCore/css/CSSImportRule.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/CSSImportRule.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSImportRule.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -27,6 +27,7 @@
#include "CachedResourceLoader.h"
#include "Document.h"
#include "MediaList.h"
+#include "MemoryInstrumentation.h"
#include "SecurityOrigin.h"
#include "StyleRuleImport.h"
#include "StyleSheetContents.h"
@@ -76,6 +77,15 @@
return result.toString();
}
+void CSSImportRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<CSSImportRule> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
+ info.addInstrumentedMember(m_importRule);
+ info.addInstrumentedMember(m_mediaCSSOMWrapper);
+ info.addInstrumentedMember(m_styleSheetCSSOMWrapper);
+}
+
CSSStyleSheet* CSSImportRule::styleSheet() const
{
if (!m_importRule->styleSheet())
Modified: trunk/Source/WebCore/css/CSSImportRule.h (124588 => 124589)
--- trunk/Source/WebCore/css/CSSImportRule.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSImportRule.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -43,6 +43,8 @@
String cssText() const;
+ void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
private:
CSSImportRule(StyleRuleImport*, CSSStyleSheet*);
Modified: trunk/Source/WebCore/css/CSSMediaRule.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/CSSMediaRule.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSMediaRule.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -27,6 +27,7 @@
#include "CSSRuleList.h"
#include "CSSStyleSheet.h"
#include "ExceptionCode.h"
+#include "MemoryInstrumentation.h"
#include "StyleRule.h"
#include <wtf/text/StringBuilder.h>
@@ -174,4 +175,13 @@
}
}
+void CSSMediaRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<CSSMediaRule> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
+ info.addInstrumentedMember(m_mediaCSSOMWrapper);
+ info.addInstrumentedVector(m_childRuleCSSOMWrappers);
+ info.addInstrumentedMember(m_ruleListCSSOMWrapper);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSMediaRule.h (124588 => 124589)
--- trunk/Source/WebCore/css/CSSMediaRule.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSMediaRule.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -52,6 +52,8 @@
void reattach(StyleRuleMedia*);
+ void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
private:
CSSMediaRule(StyleRuleMedia*, CSSStyleSheet*);
Modified: trunk/Source/WebCore/css/CSSPageRule.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/CSSPageRule.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSPageRule.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -95,4 +95,12 @@
m_propertiesCSSOMWrapper->reattach(m_pageRule->mutableProperties());
}
+void CSSPageRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<CSSPageRule> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
+ info.addInstrumentedMember(m_pageRule);
+ info.addInstrumentedMember(m_propertiesCSSOMWrapper);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSPageRule.h (124588 => 124589)
--- trunk/Source/WebCore/css/CSSPageRule.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSPageRule.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -48,6 +48,8 @@
void reattach(StyleRulePage*);
+ void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
private:
CSSPageRule(StyleRulePage*, CSSStyleSheet*);
Modified: trunk/Source/WebCore/css/CSSRule.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/CSSRule.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSRule.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -164,10 +164,59 @@
ASSERT_NOT_REACHED();
}
+void CSSRule::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ switch (type()) {
+ case UNKNOWN_RULE:
+ static_cast<const CSSUnknownRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+ return;
+ case STYLE_RULE:
+ static_cast<const CSSStyleRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+ return;
+ case PAGE_RULE:
+ static_cast<const CSSPageRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+ return;
+ case CHARSET_RULE:
+ static_cast<const CSSCharsetRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+ return;
+ case IMPORT_RULE:
+ static_cast<const CSSImportRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+ return;
+ case MEDIA_RULE:
+ static_cast<const CSSMediaRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+ return;
+ case FONT_FACE_RULE:
+ static_cast<const CSSFontFaceRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+ return;
+ case WEBKIT_KEYFRAMES_RULE:
+ static_cast<const WebKitCSSKeyframesRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+ return;
+ case WEBKIT_KEYFRAME_RULE:
+ static_cast<const WebKitCSSKeyframeRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+ return;
+#if ENABLE(CSS_REGIONS)
+ case WEBKIT_REGION_RULE:
+ static_cast<const WebKitCSSRegionRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+ return;
+#endif
+ }
+ ASSERT_NOT_REACHED();
+ return;
+}
+
const CSSParserContext& CSSRule::parserContext() const
{
CSSStyleSheet* styleSheet = parentStyleSheet();
return styleSheet ? styleSheet->contents()->parserContext() : strictCSSParserContext();
}
+void CSSRule::reportBaseClassMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<CSSRule> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ if (m_parentIsRule)
+ info.addInstrumentedMember(m_parentRule);
+ else
+ info.addInstrumentedMember(m_parentStyleSheet);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSRule.h (124588 => 124589)
--- trunk/Source/WebCore/css/CSSRule.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSRule.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -30,6 +30,7 @@
namespace WebCore {
class CSSStyleSheet;
+class MemoryObjectInfo;
class StyleRuleBase;
struct CSSParserContext;
typedef int ExceptionCode;
@@ -103,6 +104,8 @@
void reattach(StyleRuleBase*);
+ void reportMemoryUsage(MemoryObjectInfo*) const;
+
protected:
CSSRule(CSSStyleSheet* parent, Type type)
: m_hasCachedSelectorText(false)
@@ -122,6 +125,8 @@
const CSSParserContext& parserContext() const;
+ void reportBaseClassMemoryUsage(MemoryObjectInfo*) const;
+
private:
mutable unsigned m_hasCachedSelectorText : 1;
unsigned m_parentIsRule : 1;
Modified: trunk/Source/WebCore/css/CSSRuleList.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/CSSRuleList.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSRuleList.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -51,4 +51,10 @@
delete this;
}
+void StaticCSSRuleList::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<StaticCSSRuleList> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ info.addInstrumentedVector(m_rules);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSRuleList.h (124588 => 124589)
--- trunk/Source/WebCore/css/CSSRuleList.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSRuleList.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -22,6 +22,7 @@
#ifndef CSSRuleList_h
#define CSSRuleList_h
+#include "MemoryInstrumentation.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
@@ -45,6 +46,8 @@
virtual CSSRule* item(unsigned index) const = 0;
virtual CSSStyleSheet* styleSheet() const = 0;
+
+ virtual void reportMemoryUsage(MemoryObjectInfo*) const = 0;
protected:
CSSRuleList();
@@ -61,6 +64,8 @@
virtual CSSStyleSheet* styleSheet() const { return 0; }
+ virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+
private:
StaticCSSRuleList();
~StaticCSSRuleList();
@@ -80,6 +85,12 @@
virtual void ref() { m_rule->ref(); }
virtual void deref() { m_rule->deref(); }
+
+ virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE
+ {
+ MemoryClassInfo<LiveCSSRuleList<Rule> > info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ info.addInstrumentedMember(m_rule);
+ }
private:
virtual unsigned length() const { return m_rule->length(); }
Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.h (124588 => 124589)
--- trunk/Source/WebCore/css/CSSStyleDeclaration.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -30,6 +30,7 @@
class CSSProperty;
class CSSStyleSheet;
class CSSValue;
+class MemoryObjectInfo;
class StylePropertySet;
class StyledElement;
@@ -69,6 +70,8 @@
virtual bool cssPropertyMatches(const CSSProperty*) const = 0;
virtual CSSStyleSheet* parentStyleSheet() const { return 0; }
+ virtual void reportMemoryUsage(MemoryObjectInfo*) const = 0;
+
protected:
CSSStyleDeclaration() { }
};
Modified: trunk/Source/WebCore/css/CSSStyleRule.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/CSSStyleRule.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSStyleRule.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -26,6 +26,7 @@
#include "CSSSelector.h"
#include "CSSStyleSheet.h"
#include "Document.h"
+#include "MemoryInstrumentation.h"
#include "PropertySetCSSStyleDeclaration.h"
#include "StylePropertySet.h"
#include "StyleRule.h"
@@ -127,4 +128,12 @@
m_propertiesCSSOMWrapper->reattach(m_styleRule->mutableProperties());
}
+void CSSStyleRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<CSSStyleRule> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
+ info.addInstrumentedMember(m_styleRule);
+ info.addInstrumentedMember(m_propertiesCSSOMWrapper);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSStyleRule.h (124588 => 124589)
--- trunk/Source/WebCore/css/CSSStyleRule.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSStyleRule.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -50,6 +50,8 @@
void reattach(StyleRule*);
+ void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
private:
CSSStyleRule(StyleRule*, CSSStyleSheet*);
Modified: trunk/Source/WebCore/css/CSSStyleSheet.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/CSSStyleSheet.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSStyleSheet.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -53,6 +53,12 @@
virtual CSSRule* item(unsigned index) const { return m_styleSheet->item(index); }
virtual CSSStyleSheet* styleSheet() const { return m_styleSheet; }
+
+ virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE
+ {
+ MemoryClassInfo<StyleSheetCSSRuleList> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ info.addInstrumentedMember(m_styleSheet);
+ }
CSSStyleSheet* m_styleSheet;
};
@@ -176,7 +182,9 @@
info.addString(m_title);
info.addInstrumentedMember(m_mediaQueries);
info.addInstrumentedMember(m_ownerNode);
+ info.addInstrumentedMember(m_ownerRule);
info.addInstrumentedMember(m_mediaCSSOMWrapper);
+ info.addInstrumentedVector(m_childRuleCSSOMWrappers);
}
void CSSStyleSheet::setDisabled(bool disabled)
Modified: trunk/Source/WebCore/css/CSSUnknownRule.h (124588 => 124589)
--- trunk/Source/WebCore/css/CSSUnknownRule.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/CSSUnknownRule.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -23,12 +23,19 @@
#define CSSUnknownRule_h
#include "CSSRule.h"
+#include "MemoryInstrumentation.h"
namespace WebCore {
class CSSUnknownRule : public CSSRule {
public:
CSSUnknownRule() : CSSRule(0, CSSRule::UNKNOWN_RULE) { }
+
+ void reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+ {
+ MemoryClassInfo<CSSUnknownRule> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
+ }
};
} // namespace WebCore
Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -26,6 +26,7 @@
#include "CSSStyleSheet.h"
#include "HTMLNames.h"
#include "InspectorInstrumentation.h"
+#include "MemoryInstrumentation.h"
#include "MutationObserverInterestGroup.h"
#include "MutationRecord.h"
#include "StylePropertySet.h"
@@ -130,6 +131,13 @@
m_propertySet->deref();
}
+void PropertySetCSSStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<PropertySetCSSStyleDeclaration> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ info.addInstrumentedMember(m_propertySet);
+ // FIXME: add info.addInstrumentedHasMap(m_cssomCSSValueClones) when CSSValue is instrumented.
+}
+
unsigned PropertySetCSSStyleDeclaration::length() const
{
return propertySet()->propertyCount();
@@ -380,6 +388,20 @@
m_propertySet->ref();
}
+void StyleRuleCSSStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<StyleRuleCSSStyleDeclaration> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ info.visitBaseClass(this);
+ info.addInstrumentedMember(m_parentRule);
+}
+
+void InlineCSSStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<InlineCSSStyleDeclaration> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ info.visitBaseClass(this);
+ info.addInstrumentedMember(m_parentElement);
+}
+
void InlineCSSStyleDeclaration::didMutate(MutationType type)
{
if (type == NoChanges)
Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h (124588 => 124589)
--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -48,6 +48,8 @@
virtual void ref() OVERRIDE;
virtual void deref() OVERRIDE;
+ virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+
protected:
const StylePropertySet* propertySet() const { return m_propertySet; }
virtual StylePropertySet* ensureMutablePropertySet() { return m_propertySet; }
@@ -99,6 +101,8 @@
void reattach(StylePropertySet*);
+ virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+
private:
StyleRuleCSSStyleDeclaration(StylePropertySet*, CSSRule*);
virtual ~StyleRuleCSSStyleDeclaration();
@@ -124,6 +128,8 @@
, m_parentElement(parentElement)
{
}
+
+ virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
private:
virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE;
Modified: trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -113,4 +113,12 @@
return m_propertiesCSSOMWrapper.get();
}
+void WebKitCSSKeyframeRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<WebKitCSSKeyframeRule> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
+ info.addInstrumentedMember(m_keyframe);
+ info.addInstrumentedMember(m_propertiesCSSOMWrapper);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h (124588 => 124589)
--- trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -80,6 +80,8 @@
String cssText() const { return m_keyframe->cssText(); }
+ void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
private:
WebKitCSSKeyframeRule(StyleKeyframe*, WebKitCSSKeyframesRule* parent);
Modified: trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -206,4 +206,13 @@
m_keyframesRule = rule;
}
+void WebKitCSSKeyframesRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<WebKitCSSKeyframesRule> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
+ info.addInstrumentedMember(m_keyframesRule);
+ info.addInstrumentedVector(m_childRuleCSSOMWrappers);
+ info.addInstrumentedMember(m_ruleListCSSOMWrapper);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/css/WebKitCSSKeyframesRule.h (124588 => 124589)
--- trunk/Source/WebCore/css/WebKitCSSKeyframesRule.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframesRule.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -92,6 +92,8 @@
void reattach(StyleRuleKeyframes*);
+ void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
private:
WebKitCSSKeyframesRule(StyleRuleKeyframes*, CSSStyleSheet* parent);
Modified: trunk/Source/WebCore/css/WebKitCSSRegionRule.cpp (124588 => 124589)
--- trunk/Source/WebCore/css/WebKitCSSRegionRule.cpp 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/WebKitCSSRegionRule.cpp 2012-08-03 10:18:31 UTC (rev 124589)
@@ -108,6 +108,15 @@
}
}
+void WebKitCSSRegionRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<WebKitCSSRegionRule> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
+ info.addInstrumentedMember(m_regionRule);
+ info.addInstrumentedVector(m_childRuleCSSOMWrappers);
+ info.addInstrumentedMember(m_ruleListCSSOMWrapper);
+}
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/css/WebKitCSSRegionRule.h (124588 => 124589)
--- trunk/Source/WebCore/css/WebKitCSSRegionRule.h 2012-08-03 10:14:44 UTC (rev 124588)
+++ trunk/Source/WebCore/css/WebKitCSSRegionRule.h 2012-08-03 10:18:31 UTC (rev 124589)
@@ -57,6 +57,8 @@
void reattach(StyleRuleRegion*);
+ void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
private:
WebKitCSSRegionRule(StyleRuleRegion*, CSSStyleSheet* parent);