Chromium Code Reviews| Index: Source/core/css/RuleFeature.cpp |
| diff --git a/Source/core/css/RuleFeature.cpp b/Source/core/css/RuleFeature.cpp |
| index 272b9b06ce26109250e0f41884055f8a8e5f32f2..6d5d91a14408129b0e1de73e95f74328bb1a3756 100644 |
| --- a/Source/core/css/RuleFeature.cpp |
| +++ b/Source/core/css/RuleFeature.cpp |
| @@ -37,6 +37,7 @@ |
| #include "core/css/invalidation/DescendantInvalidationSet.h" |
| #include "core/dom/Element.h" |
| #include "core/dom/Node.h" |
| +#include "core/inspector/InspectorTraceEvents.h" |
| #include "wtf/BitVector.h" |
| namespace blink { |
| @@ -188,11 +189,18 @@ static bool requiresSubtreeInvalidation(const CSSSelector& selector) |
| } |
| } |
| +static const unsigned char* s_tracingEnabled = nullptr; |
| + |
| +#define TRACE_SCHEDULE_STYLE_INVALIDATION_IF_ENABLED(...) \ |
| + if (UNLIKELY(*s_tracingEnabled)) \ |
| + TRACE_SCHEDULE_STYLE_INVALIDATION(__VA_ARGS__); |
| + |
| RuleFeature::RuleFeature(StyleRule* rule, unsigned selectorIndex, bool hasDocumentSecurityOrigin) |
| : rule(rule) |
| , selectorIndex(selectorIndex) |
| , hasDocumentSecurityOrigin(hasDocumentSecurityOrigin) |
| { |
| + s_tracingEnabled = TRACE_EVENT_API_GET_CATEGORY_ENABLED(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking")); |
|
rune
2014/10/20 07:24:03
This looks like a strange place to initialize that
kouhei (in TOK)
2014/10/20 09:06:20
Thanks for your comment.
This is a bit confusing
rune
2014/10/20 09:18:18
Yes, I see that now. Still, I think it would be be
|
| } |
| void RuleFeature::trace(Visitor* visitor) |
| @@ -598,33 +606,42 @@ void RuleFeatureSet::scheduleStyleInvalidationForClassChange(const SpaceSplitStr |
| void RuleFeatureSet::scheduleStyleInvalidationForAttributeChange(const QualifiedName& attributeName, Element& element) |
| { |
| - |
| - if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_attributeInvalidationSets.get(attributeName.localName())) |
| + if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_attributeInvalidationSets.get(attributeName.localName())) { |
| + TRACE_SCHEDULE_STYLE_INVALIDATION_IF_ENABLED(element, *invalidationSet, attributeChange, attributeName); |
| m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| + } |
| } |
| void RuleFeatureSet::scheduleStyleInvalidationForIdChange(const AtomicString& oldId, const AtomicString& newId, Element& element) |
| { |
| if (!oldId.isEmpty()) { |
| - if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_idInvalidationSets.get(oldId)) |
| + if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_idInvalidationSets.get(oldId)) { |
| + TRACE_SCHEDULE_STYLE_INVALIDATION_IF_ENABLED(element, *invalidationSet, idChange, oldId); |
| m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| + } |
| } |
| if (!newId.isEmpty()) { |
| - if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_idInvalidationSets.get(newId)) |
| + if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_idInvalidationSets.get(newId)) { |
| + TRACE_SCHEDULE_STYLE_INVALIDATION_IF_ENABLED(element, *invalidationSet, idChange, newId); |
| m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| + } |
| } |
| } |
| void RuleFeatureSet::scheduleStyleInvalidationForPseudoChange(CSSSelector::PseudoType pseudo, Element& element) |
| { |
| - if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_pseudoInvalidationSets.get(pseudo)) |
| + if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_pseudoInvalidationSets.get(pseudo)) { |
| + TRACE_SCHEDULE_STYLE_INVALIDATION_IF_ENABLED(element, *invalidationSet, pseudoChange, pseudo); |
| m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| + } |
| } |
| void RuleFeatureSet::addClassToInvalidationSet(const AtomicString& className, Element& element) |
| { |
| - if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_classInvalidationSets.get(className)) |
| + if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_classInvalidationSets.get(className)) { |
| + TRACE_SCHEDULE_STYLE_INVALIDATION_IF_ENABLED(element, *invalidationSet, classChange, className); |
| m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| + } |
| } |
| StyleInvalidator& RuleFeatureSet::styleInvalidator() |