Index: third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h |
diff --git a/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h b/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h |
index 3a922578091629e909d550cd1c2a5b741f410fad..f6010ee4023ae5e8b2fafaa91a667def100f770a 100644 |
--- a/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h |
+++ b/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h |
@@ -58,10 +58,8 @@ class CORE_EXPORT InvalidationSet : public RefCounted<InvalidationSet> { |
WTF_MAKE_NONCOPYABLE(InvalidationSet); |
USING_FAST_MALLOC_WITH_TYPE_NAME(blink::InvalidationSet); |
public: |
- virtual ~InvalidationSet() {} |
- |
- virtual bool isDescendantInvalidationSet() const { return false; } |
- virtual bool isSiblingInvalidationSet() const { return false; } |
+ bool isDescendantInvalidationSet() const { return m_type == InvalidateDescendants; } |
+ bool isSiblingInvalidationSet() const { return m_type == InvalidateSiblings; } |
static void cacheTracingFlag(); |
@@ -100,12 +98,21 @@ public: |
const HashSet<AtomicString>& tagNameSetForTesting() const { ASSERT(m_tagNames); return *m_tagNames; } |
const HashSet<AtomicString>& attributeSetForTesting() const { ASSERT(m_attributes); return *m_attributes; } |
+ void deref() |
+ { |
+ if (!derefBase()) |
+ return; |
+ destroy(); |
+ } |
+ |
protected: |
- InvalidationSet(); |
+ InvalidationSet(InvalidationType); |
void combine(const InvalidationSet& other); |
private: |
+ void destroy(); |
+ |
HashSet<AtomicString>& ensureClassSet(); |
HashSet<AtomicString>& ensureIdSet(); |
HashSet<AtomicString>& ensureTagNameSet(); |
@@ -117,6 +124,8 @@ private: |
OwnPtr<HashSet<AtomicString>> m_tagNames; |
OwnPtr<HashSet<AtomicString>> m_attributes; |
+ unsigned m_type : 1; |
+ |
// If true, all descendants might be invalidated, so a full subtree recalc is required. |
unsigned m_allDescendantsMightBeInvalid : 1; |
@@ -140,15 +149,14 @@ public: |
return adoptRef(new DescendantInvalidationSet); |
} |
- bool isDescendantInvalidationSet() const final { return true; } |
- |
void combine(const DescendantInvalidationSet& other) |
{ |
InvalidationSet::combine(other); |
} |
private: |
- DescendantInvalidationSet() {} |
+ DescendantInvalidationSet() |
+ : InvalidationSet(InvalidateDescendants) {} |
}; |
class CORE_EXPORT SiblingInvalidationSet final : public InvalidationSet { |
@@ -158,8 +166,6 @@ public: |
return adoptRef(new SiblingInvalidationSet); |
} |
- bool isSiblingInvalidationSet() const final { return true; } |
- |
void combine(const SiblingInvalidationSet& other); |
DescendantInvalidationSet& descendants() { return *m_descendantInvalidationSet; } |