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

Unified Diff: third_party/WebKit/Source/core/css/RuleFeature.cpp

Issue 2303443003: CSS: Additional asserts for style invalidation (Closed)
Patch Set: key not empty Created 4 years, 3 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 | « no previous file | third_party/WebKit/Source/core/css/invalidation/InvalidationSet.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/RuleFeature.cpp
diff --git a/third_party/WebKit/Source/core/css/RuleFeature.cpp b/third_party/WebKit/Source/core/css/RuleFeature.cpp
index 8ba872b147dd812063caee2a940108d165509c56..d3a29f108dc2675d152c311e7cf50ef1d8fb8658 100644
--- a/third_party/WebKit/Source/core/css/RuleFeature.cpp
+++ b/third_party/WebKit/Source/core/css/RuleFeature.cpp
@@ -223,7 +223,9 @@ InvalidationSet& ensureInvalidationSet(Map& map, const typename Map::KeyType& ke
if (type == InvalidateDescendants)
return toSiblingInvalidationSet(addResult.storedValue->value.get())->ensureDescendants();
- addResult.storedValue->value = SiblingInvalidationSet::create(toDescendantInvalidationSet(addResult.storedValue->value.get()));
+ RefPtr<InvalidationSet> descendants = addResult.storedValue->value;
+ RefPtr<InvalidationSet> siblings = SiblingInvalidationSet::create(toDescendantInvalidationSet(descendants.get()));
+ addResult.storedValue->value = siblings;
return *addResult.storedValue->value;
}
@@ -276,21 +278,25 @@ RuleFeatureSet::~RuleFeatureSet()
ALWAYS_INLINE InvalidationSet& RuleFeatureSet::ensureClassInvalidationSet(const AtomicString& className, InvalidationType type)
{
+ RELEASE_ASSERT(!className.isEmpty());
return ensureInvalidationSet(m_classInvalidationSets, className, type);
}
ALWAYS_INLINE InvalidationSet& RuleFeatureSet::ensureAttributeInvalidationSet(const AtomicString& attributeName, InvalidationType type)
{
+ RELEASE_ASSERT(!attributeName.isEmpty());
return ensureInvalidationSet(m_attributeInvalidationSets, attributeName, type);
}
ALWAYS_INLINE InvalidationSet& RuleFeatureSet::ensureIdInvalidationSet(const AtomicString& id, InvalidationType type)
{
+ RELEASE_ASSERT(!id.isEmpty());
return ensureInvalidationSet(m_idInvalidationSets, id, type);
}
ALWAYS_INLINE InvalidationSet& RuleFeatureSet::ensurePseudoInvalidationSet(CSSSelector::PseudoType pseudoType, InvalidationType type)
{
+ RELEASE_ASSERT(pseudoType != CSSSelector::PseudoUnknown);
return ensureInvalidationSet(m_pseudoInvalidationSets, pseudoType, type);
}
@@ -730,6 +736,7 @@ void RuleFeatureSet::add(const RuleFeatureSet& other)
{
RELEASE_ASSERT(m_isAlive);
RELEASE_ASSERT(other.m_isAlive);
+ RELEASE_ASSERT(&other != this);
for (const auto& entry : other.m_classInvalidationSets)
ensureInvalidationSet(m_classInvalidationSets, entry.key, entry.value->type()).combine(*entry.value);
for (const auto& entry : other.m_attributeInvalidationSets)
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/invalidation/InvalidationSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698