Index: Source/core/css/CSSRuleList.h |
diff --git a/Source/core/css/CSSRuleList.h b/Source/core/css/CSSRuleList.h |
index b3d7488d70b893450bf5a91a331894cd10fe03ac..4ff78390878a5f2aa3cc685458f3464f4927bba9 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,39 @@ 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. |
+// The rule owns the live list. FIXME: oilpan: Delete this comment. |
Mads Ager (chromium)
2014/03/12 12:24:42
Let's just remove this comment. The fact that OwnP
Erik Corry
2014/03/12 12:31:27
Done.
|
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 |