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

Side by Side Diff: Source/core/css/invalidation/StyleInvalidator.cpp

Issue 650343004: Add comment on StyleInvalidator trace events (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #include "config.h" 6 #include "config.h"
7 7
8 #include "core/css/invalidation/StyleInvalidator.h" 8 #include "core/css/invalidation/StyleInvalidator.h"
9 9
10 #include "core/css/invalidation/DescendantInvalidationSet.h" 10 #include "core/css/invalidation/DescendantInvalidationSet.h"
11 #include "core/dom/Document.h" 11 #include "core/dom/Document.h"
12 #include "core/dom/Element.h" 12 #include "core/dom/Element.h"
13 #include "core/dom/ElementTraversal.h" 13 #include "core/dom/ElementTraversal.h"
14 #include "core/dom/shadow/ElementShadow.h" 14 #include "core/dom/shadow/ElementShadow.h"
15 #include "core/dom/shadow/ShadowRoot.h" 15 #include "core/dom/shadow/ShadowRoot.h"
16 #include "core/inspector/InspectorTraceEvents.h" 16 #include "core/inspector/InspectorTraceEvents.h"
17 #include "core/rendering/RenderObject.h" 17 #include "core/rendering/RenderObject.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 // StyleInvalidator methods are super sensitive to performance benchmarks.
22 // We easily get 1% regression per additional if statement on recursive
23 // invalidate methods.
24 // To minimize performance impact, we wrap trace events with a lookup of
25 // cached flag. The cached flag is made "static const" and is not shared
26 // with DescendantInvalidationSet to avoid additional GOT lookup cost.
21 static const unsigned char* s_tracingEnabled = nullptr; 27 static const unsigned char* s_tracingEnabled = nullptr;
22 28
23 #define TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, reason) \ 29 #define TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, reason) \
24 if (UNLIKELY(*s_tracingEnabled)) \ 30 if (UNLIKELY(*s_tracingEnabled)) \
25 TRACE_STYLE_INVALIDATOR_INVALIDATION(element, reason); 31 TRACE_STYLE_INVALIDATOR_INVALIDATION(element, reason);
26 32
27 void StyleInvalidator::invalidate(Document& document) 33 void StyleInvalidator::invalidate(Document& document)
28 { 34 {
29 RecursionData recursionData; 35 RecursionData recursionData;
30 if (Element* documentElement = document.documentElement()) 36 if (Element* documentElement = document.documentElement())
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 194 }
189 195
190 void StyleInvalidator::trace(Visitor* visitor) 196 void StyleInvalidator::trace(Visitor* visitor)
191 { 197 {
192 #if ENABLE(OILPAN) 198 #if ENABLE(OILPAN)
193 visitor->trace(m_pendingInvalidationMap); 199 visitor->trace(m_pendingInvalidationMap);
194 #endif 200 #endif
195 } 201 }
196 202
197 } // namespace blink 203 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698