Chromium Code Reviews| Index: Source/core/css/CSSRuleList.h |
| diff --git a/Source/core/css/CSSRuleList.h b/Source/core/css/CSSRuleList.h |
| index b3d7488d70b893450bf5a91a331894cd10fe03ac..b916221d5e610b5a7c85f717e08eecbedd97e82c 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*) { } |
|
Mads Ager (chromium)
2014/03/10 12:32:57
Make this a pure virtual as well? (Either that or
zerny-chromium
2014/03/10 14:00:21
The plugin should warn that this trace is not call
Erik Corry
2014/03/12 10:36:41
Done.
Erik Corry
2014/03/12 10:36:41
Done.
|
| + |
| 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,40 @@ 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. |
| 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 |
| + { |
| + CSSRuleList::trace(visitor); |
|
Mads Ager (chromium)
2014/03/10 12:32:57
If you make it pure virtual you can leave this one
Erik Corry
2014/03/12 10:36:41
Done.
|
| + 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 |