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

Unified Diff: Source/core/css/CSSRuleList.h

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/CSSRule.cpp ('k') | Source/core/css/CSSRuleList.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSRuleList.h
diff --git a/Source/core/css/CSSRuleList.h b/Source/core/css/CSSRuleList.h
index b3d7488d70b893450bf5a91a331894cd10fe03ac..7ba94efe6576f8d5cf034cae9c0f8484394dc9cf 100644
--- a/Source/core/css/CSSRuleList.h
+++ b/Source/core/css/CSSRuleList.h
@@ -32,34 +32,46 @@ namespace WebCore {
class CSSRule;
class CSSStyleSheet;
-class CSSRuleList {
- WTF_MAKE_NONCOPYABLE(CSSRuleList); WTF_MAKE_FAST_ALLOCATED;
+class CSSRuleList : public NoBaseWillBeGarbageCollectedFinalized<CSSRuleList> {
+ WTF_MAKE_NONCOPYABLE(CSSRuleList);
+ WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
public:
virtual ~CSSRuleList();
+#if !ENABLE(OILPAN)
virtual void ref() = 0;
virtual void deref() = 0;
+#endif
virtual unsigned length() const = 0;
virtual CSSRule* item(unsigned index) const = 0;
virtual CSSStyleSheet* styleSheet() const = 0;
+ virtual void trace(Visitor*) = 0;
+
protected:
CSSRuleList();
};
class StaticCSSRuleList FINAL : public CSSRuleList {
public:
- static PassRefPtr<StaticCSSRuleList> create() { return adoptRef(new StaticCSSRuleList()); }
+ static PassRefPtrWillBeRawPtr<StaticCSSRuleList> create()
+ {
+ return adoptRefWillBeNoop(new StaticCSSRuleList());
+ }
+#if !ENABLE(OILPAN)
virtual void ref() OVERRIDE { ++m_refCount; }
virtual void deref() OVERRIDE;
+#endif
- WillBePersistentHeapVector<RefPtrWillBeMember<CSSRule> >& rules() { return m_rules; }
+ WillBeHeapVector<RefPtrWillBeMember<CSSRule> >& rules() { return m_rules; }
virtual CSSStyleSheet* styleSheet() const OVERRIDE { return 0; }
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
StaticCSSRuleList();
virtual ~StaticCSSRuleList();
@@ -67,31 +79,38 @@ private:
virtual unsigned length() const OVERRIDE { return m_rules.size(); }
virtual CSSRule* item(unsigned index) const OVERRIDE { return index < m_rules.size() ? m_rules[index].get() : 0; }
- WillBePersistentHeapVector<RefPtrWillBeMember<CSSRule> > m_rules;
+ WillBeHeapVector<RefPtrWillBeMember<CSSRule> > m_rules;
+#if !ENABLE(OILPAN)
unsigned m_refCount;
+#endif
};
-// The rule owns the live list.
template <class Rule>
class LiveCSSRuleList FINAL : public CSSRuleList {
public:
- LiveCSSRuleList(Rule* rule) : m_rule(rule) { }
+ static PassOwnPtrWillBeRawPtr<LiveCSSRuleList> create(Rule* rule)
+ {
+ return adoptPtrWillBeNoop(new LiveCSSRuleList(rule));
+ }
+#if !ENABLE(OILPAN)
virtual void ref() OVERRIDE { m_rule->ref(); }
virtual void deref() OVERRIDE { m_rule->deref(); }
+#endif
+
+ virtual void trace(Visitor* visitor) OVERRIDE
+ {
+ visitor->trace(m_rule);
+ }
private:
+ LiveCSSRuleList(Rule* rule) : m_rule(rule) { }
+
virtual unsigned length() const OVERRIDE { return m_rule->length(); }
virtual CSSRule* item(unsigned index) const OVERRIDE { return m_rule->item(index); }
virtual CSSStyleSheet* styleSheet() const OVERRIDE { return m_rule->parentStyleSheet(); }
- // FIXME: oilpan: This is always a subclass of CSSRule, so it should be
- // RawPtrWillBeMember<Rule>, but that would leak right now in Oilpan mode:
- // m_ruleListCSSOMWrapper is an OwnPtr pointing at CSSRuleList, which is a
- // superclass of this class, and this points at things that have an
- // m_ruleListCSSOMWrapper field. When LiveCSSRuleList is moved to the GCed
- // heap, this can be fixed.
- Rule* m_rule;
+ RawPtrWillBeMember<Rule> m_rule;
};
} // namespace WebCore
« no previous file with comments | « Source/core/css/CSSRule.cpp ('k') | Source/core/css/CSSRuleList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698