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

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

Issue 664033002: [Invalidation Tracking] Trace ScheduleStyleInvalidation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: no regression :) Created 6 years, 2 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 | Source/core/inspector/InspectorTraceEvents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « no previous file | Source/core/inspector/InspectorTraceEvents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698