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

Unified Diff: Source/core/css/analyzer/DescendantInvalidationSet.cpp

Issue 177653003: Free HashSets on setWholeSubtreeInvalid. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
Index: Source/core/css/analyzer/DescendantInvalidationSet.cpp
diff --git a/Source/core/css/analyzer/DescendantInvalidationSet.cpp b/Source/core/css/analyzer/DescendantInvalidationSet.cpp
index 5cb3785b594df8aca99d704623511a94fe705e93..8a4aa57278870684f6b4efb9aa1152d748ea8673 100644
--- a/Source/core/css/analyzer/DescendantInvalidationSet.cpp
+++ b/Source/core/css/analyzer/DescendantInvalidationSet.cpp
@@ -43,11 +43,15 @@ DescendantInvalidationSet::DescendantInvalidationSet()
void DescendantInvalidationSet::combine(const DescendantInvalidationSet& other)
{
- m_allDescendantsMightBeInvalid = m_allDescendantsMightBeInvalid || other.m_allDescendantsMightBeInvalid;
// No longer bother combining data structures, since the whole subtree is deemed invalid.
- if (m_allDescendantsMightBeInvalid)
+ if (wholeSubtreeInvalid())
return;
+ if (other.wholeSubtreeInvalid()) {
+ setWholeSubtreeInvalid();
+ return;
+ }
+
if (other.m_classes) {
HashSet<AtomicString>::const_iterator end = other.m_classes->end();
for (HashSet<AtomicString>::const_iterator it = other.m_classes->begin(); it != end; ++it)
@@ -90,20 +94,26 @@ HashSet<AtomicString>& DescendantInvalidationSet::ensureTagNameSet()
void DescendantInvalidationSet::addClass(const AtomicString& className)
{
+ if (wholeSubtreeInvalid())
+ return;
ensureClassSet().add(className);
}
void DescendantInvalidationSet::addId(const AtomicString& id)
{
+ if (wholeSubtreeInvalid())
+ return;
ensureIdSet().add(id);
}
void DescendantInvalidationSet::addTagName(const AtomicString& tagName)
{
+ if (wholeSubtreeInvalid())
+ return;
ensureTagNameSet().add(tagName);
}
-void DescendantInvalidationSet::getClasses(Vector<AtomicString>& classes)
+void DescendantInvalidationSet::getClasses(Vector<AtomicString>& classes) const
{
if (!m_classes)
return;

Powered by Google App Engine
This is Rietveld 408576698