Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Unified Diff: Source/core/css/CSSStyleSheet.cpp

Issue 192473003: Move CSSRuleList to the garbage collected heap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ager feedback Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/CSSStyleSheet.h ('k') | Source/core/css/CSSSupportsRule.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSStyleSheet.cpp
diff --git a/Source/core/css/CSSStyleSheet.cpp b/Source/core/css/CSSStyleSheet.cpp
index 6fda90bfab319e8fcf684a2291da58ab170e16ef..928a451382cf0afffc0afdd210f30bbe9b1eb6dd 100644
--- a/Source/core/css/CSSStyleSheet.cpp
+++ b/Source/core/css/CSSStyleSheet.cpp
@@ -46,18 +46,30 @@ namespace WebCore {
class StyleSheetCSSRuleList FINAL : public CSSRuleList {
public:
- StyleSheetCSSRuleList(CSSStyleSheet* sheet) : m_styleSheet(sheet) { }
+ static PassOwnPtrWillBeRawPtr<StyleSheetCSSRuleList> create(CSSStyleSheet* sheet)
+ {
+ return adoptPtrWillBeNoop(new StyleSheetCSSRuleList(sheet));
+ }
+
+ virtual void trace(Visitor* visitor) OVERRIDE
+ {
+ visitor->trace(m_styleSheet);
+ }
private:
+ StyleSheetCSSRuleList(CSSStyleSheet* sheet) : m_styleSheet(sheet) { }
+
+#if !ENABLE(OILPAN)
virtual void ref() OVERRIDE { m_styleSheet->ref(); }
virtual void deref() OVERRIDE { m_styleSheet->deref(); }
+#endif
virtual unsigned length() const OVERRIDE { return m_styleSheet->length(); }
virtual CSSRule* item(unsigned index) const OVERRIDE { return m_styleSheet->item(index); }
virtual CSSStyleSheet* styleSheet() const OVERRIDE { return m_styleSheet; }
- CSSStyleSheet* m_styleSheet;
+ RawPtrWillBeMember<CSSStyleSheet> m_styleSheet;
};
#if !ASSERT_DISABLED
@@ -258,12 +270,12 @@ bool CSSStyleSheet::canAccessRules() const
return false;
}
-PassRefPtr<CSSRuleList> CSSStyleSheet::rules()
+PassRefPtrWillBeRawPtr<CSSRuleList> CSSStyleSheet::rules()
{
if (!canAccessRules())
return nullptr;
// IE behavior.
- RefPtr<StaticCSSRuleList> nonCharsetRules = StaticCSSRuleList::create();
+ RefPtrWillBeRawPtr<StaticCSSRuleList> nonCharsetRules(StaticCSSRuleList::create());
unsigned ruleCount = length();
for (unsigned i = 0; i < ruleCount; ++i) {
CSSRule* rule = item(i);
@@ -349,12 +361,12 @@ int CSSStyleSheet::addRule(const String& selector, const String& style, Exceptio
}
-PassRefPtr<CSSRuleList> CSSStyleSheet::cssRules()
+PassRefPtrWillBeRawPtr<CSSRuleList> CSSStyleSheet::cssRules()
{
if (!canAccessRules())
return nullptr;
if (!m_ruleListCSSOMWrapper)
- m_ruleListCSSOMWrapper = adoptPtr(new StyleSheetCSSRuleList(this));
+ m_ruleListCSSOMWrapper = StyleSheetCSSRuleList::create(this);
return m_ruleListCSSOMWrapper.get();
}
@@ -421,6 +433,7 @@ void CSSStyleSheet::trace(Visitor* visitor)
visitor->trace(m_ownerRule);
visitor->trace(m_mediaCSSOMWrapper);
visitor->trace(m_childRuleCSSOMWrappers);
+ visitor->trace(m_ruleListCSSOMWrapper);
}
}
« no previous file with comments | « Source/core/css/CSSStyleSheet.h ('k') | Source/core/css/CSSSupportsRule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698