OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #define TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART_IF_ENABLED(element, re
ason, invalidationSet, singleSelectorPart) \ | 45 #define TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART_IF_ENABLED(element, re
ason, invalidationSet, singleSelectorPart) \ |
46 if (UNLIKELY(*s_tracingEnabled)) \ | 46 if (UNLIKELY(*s_tracingEnabled)) \ |
47 TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART(element, reason, inval
idationSet, singleSelectorPart); | 47 TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART(element, reason, inval
idationSet, singleSelectorPart); |
48 | 48 |
49 void DescendantInvalidationSet::cacheTracingFlag() | 49 void DescendantInvalidationSet::cacheTracingFlag() |
50 { | 50 { |
51 s_tracingEnabled = TRACE_EVENT_API_GET_CATEGORY_ENABLED(TRACE_DISABLED_BY_DE
FAULT("devtools.timeline.invalidationTracking")); | 51 s_tracingEnabled = TRACE_EVENT_API_GET_CATEGORY_ENABLED(TRACE_DISABLED_BY_DE
FAULT("devtools.timeline.invalidationTracking")); |
52 } | 52 } |
53 | 53 |
54 DescendantInvalidationSet::DescendantInvalidationSet() | 54 DescendantInvalidationSet::DescendantInvalidationSet() |
55 : m_allDescendantsMightBeInvalid(false) | 55 : m_maxDirectAdjacentSelectors(1) |
| 56 , m_allDescendantsMightBeInvalid(false) |
56 , m_customPseudoInvalid(false) | 57 , m_customPseudoInvalid(false) |
57 , m_treeBoundaryCrossing(false) | 58 , m_treeBoundaryCrossing(false) |
58 , m_insertionPointCrossing(false) | 59 , m_insertionPointCrossing(false) |
59 { | 60 { |
60 } | 61 } |
61 | 62 |
62 bool DescendantInvalidationSet::invalidatesElement(Element& element) const | 63 bool DescendantInvalidationSet::invalidatesElement(Element& element) const |
63 { | 64 { |
64 if (m_allDescendantsMightBeInvalid) | 65 if (m_allDescendantsMightBeInvalid) |
65 return true; | 66 return true; |
(...skipping 25 matching lines...) Expand all Loading... |
91 return true; | 92 return true; |
92 } | 93 } |
93 } | 94 } |
94 } | 95 } |
95 | 96 |
96 return false; | 97 return false; |
97 } | 98 } |
98 | 99 |
99 void DescendantInvalidationSet::combine(const DescendantInvalidationSet& other) | 100 void DescendantInvalidationSet::combine(const DescendantInvalidationSet& other) |
100 { | 101 { |
| 102 m_maxDirectAdjacentSelectors = std::max(m_maxDirectAdjacentSelectors, other.
m_maxDirectAdjacentSelectors); |
| 103 |
101 // No longer bother combining data structures, since the whole subtree is de
emed invalid. | 104 // No longer bother combining data structures, since the whole subtree is de
emed invalid. |
102 if (wholeSubtreeInvalid()) | 105 if (wholeSubtreeInvalid()) |
103 return; | 106 return; |
104 | 107 |
105 if (other.wholeSubtreeInvalid()) { | 108 if (other.wholeSubtreeInvalid()) { |
106 setWholeSubtreeInvalid(); | 109 setWholeSubtreeInvalid(); |
107 return; | 110 return; |
108 } | 111 } |
109 | 112 |
110 if (other.customPseudoInvalid()) | 113 if (other.customPseudoInvalid()) |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 { | 272 { |
270 RefPtr<TracedValue> value = TracedValue::create(); | 273 RefPtr<TracedValue> value = TracedValue::create(); |
271 value->beginArray("DescendantInvalidationSet"); | 274 value->beginArray("DescendantInvalidationSet"); |
272 toTracedValue(value.get()); | 275 toTracedValue(value.get()); |
273 value->endArray(); | 276 value->endArray(); |
274 fprintf(stderr, "%s\n", value->asTraceFormat().ascii().data()); | 277 fprintf(stderr, "%s\n", value->asTraceFormat().ascii().data()); |
275 } | 278 } |
276 #endif // NDEBUG | 279 #endif // NDEBUG |
277 | 280 |
278 } // namespace blink | 281 } // namespace blink |
OLD | NEW |