Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef StyleInvalidator_h | 5 #ifndef StyleInvalidator_h |
| 6 #define StyleInvalidator_h | 6 #define StyleInvalidator_h |
| 7 | 7 |
| 8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 #include "wtf/Noncopyable.h" | 9 #include "wtf/Noncopyable.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 ~StyleInvalidator(); | 22 ~StyleInvalidator(); |
| 23 void invalidate(Document&); | 23 void invalidate(Document&); |
| 24 void scheduleInvalidation(PassRefPtrWillBeRawPtr<DescendantInvalidationSet>, Element&); | 24 void scheduleInvalidation(PassRefPtrWillBeRawPtr<DescendantInvalidationSet>, Element&); |
| 25 void clearInvalidation(Element&); | 25 void clearInvalidation(Element&); |
| 26 | 26 |
| 27 void clearPendingInvalidations(); | 27 void clearPendingInvalidations(); |
| 28 | 28 |
| 29 DECLARE_TRACE(); | 29 DECLARE_TRACE(); |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 struct RecursionData { | 32 class RecursionData { |
| 33 DISALLOW_ALLOCATION(); | |
|
sof
2015/07/22 06:08:42
STACK_ALLOCATED() ?
keishi
2015/07/22 06:30:47
Done.
| |
| 34 public: | |
| 33 RecursionData() | 35 RecursionData() |
| 34 : m_invalidateCustomPseudo(false) | 36 : m_invalidateCustomPseudo(false) |
| 35 , m_wholeSubtreeInvalid(false) | 37 , m_wholeSubtreeInvalid(false) |
| 36 , m_treeBoundaryCrossing(false) | 38 , m_treeBoundaryCrossing(false) |
| 37 , m_insertionPointCrossing(false) | 39 , m_insertionPointCrossing(false) |
| 38 { } | 40 { } |
| 39 | 41 |
| 42 DEFINE_INLINE_TRACE() | |
|
sof
2015/07/22 06:08:42
Don't need this, as the backing store will be mark
keishi
2015/07/22 06:30:47
Done.
| |
| 43 { | |
| 44 #if ENABLE(OILPAN) | |
| 45 visitor->trace(m_invalidationSets); | |
| 46 #endif | |
| 47 } | |
| 48 | |
| 40 void pushInvalidationSet(const DescendantInvalidationSet&); | 49 void pushInvalidationSet(const DescendantInvalidationSet&); |
| 41 bool matchesCurrentInvalidationSets(Element&); | 50 bool matchesCurrentInvalidationSets(Element&); |
| 42 bool hasInvalidationSets() const { return !wholeSubtreeInvalid() && m_in validationSets.size(); } | 51 bool hasInvalidationSets() const { return !wholeSubtreeInvalid() && m_in validationSets.size(); } |
| 43 | 52 |
| 44 bool wholeSubtreeInvalid() const { return m_wholeSubtreeInvalid; } | 53 bool wholeSubtreeInvalid() const { return m_wholeSubtreeInvalid; } |
| 45 void setWholeSubtreeInvalid() { m_wholeSubtreeInvalid = true; } | 54 void setWholeSubtreeInvalid() { m_wholeSubtreeInvalid = true; } |
| 46 | 55 |
| 47 bool treeBoundaryCrossing() const { return m_treeBoundaryCrossing; } | 56 bool treeBoundaryCrossing() const { return m_treeBoundaryCrossing; } |
| 48 bool insertionPointCrossing() const { return m_insertionPointCrossing; } | 57 bool insertionPointCrossing() const { return m_insertionPointCrossing; } |
| 49 | 58 |
| 50 using InvalidationSets = Vector<const DescendantInvalidationSet*, 16>; | 59 using InvalidationSets = WillBeHeapVector<RawPtrWillBeMember<const Desce ndantInvalidationSet>, 16>; |
| 51 InvalidationSets m_invalidationSets; | 60 InvalidationSets m_invalidationSets; |
| 52 bool m_invalidateCustomPseudo; | 61 bool m_invalidateCustomPseudo; |
| 53 bool m_wholeSubtreeInvalid; | 62 bool m_wholeSubtreeInvalid; |
| 54 bool m_treeBoundaryCrossing; | 63 bool m_treeBoundaryCrossing; |
| 55 bool m_insertionPointCrossing; | 64 bool m_insertionPointCrossing; |
| 56 }; | 65 }; |
| 57 | 66 |
| 58 bool invalidate(Element&, RecursionData&); | 67 bool invalidate(Element&, RecursionData&); |
| 59 bool invalidateChildren(Element&, RecursionData&); | 68 bool invalidateChildren(Element&, RecursionData&); |
| 60 bool checkInvalidationSetsAgainstElement(Element&, RecursionData&); | 69 bool checkInvalidationSetsAgainstElement(Element&, RecursionData&); |
| 61 | 70 |
| 62 class RecursionCheckpoint { | 71 class RecursionCheckpoint { |
| 72 DISALLOW_ALLOCATION(); | |
|
sof
2015/07/22 06:08:42
STACK_ALLOCATED() ?
keishi
2015/07/22 06:30:47
Done.
| |
| 63 public: | 73 public: |
| 64 RecursionCheckpoint(RecursionData* data) | 74 RecursionCheckpoint(RecursionData* data) |
| 65 : m_prevInvalidationSetsSize(data->m_invalidationSets.size()) | 75 : m_prevInvalidationSetsSize(data->m_invalidationSets.size()) |
| 66 , m_prevInvalidateCustomPseudo(data->m_invalidateCustomPseudo) | 76 , m_prevInvalidateCustomPseudo(data->m_invalidateCustomPseudo) |
| 67 , m_prevWholeSubtreeInvalid(data->m_wholeSubtreeInvalid) | 77 , m_prevWholeSubtreeInvalid(data->m_wholeSubtreeInvalid) |
| 68 , m_treeBoundaryCrossing(data->m_treeBoundaryCrossing) | 78 , m_treeBoundaryCrossing(data->m_treeBoundaryCrossing) |
| 69 , m_insertionPointCrossing(data->m_insertionPointCrossing) | 79 , m_insertionPointCrossing(data->m_insertionPointCrossing) |
| 70 , m_data(data) | 80 , m_data(data) |
| 71 { } | 81 { } |
| 72 ~RecursionCheckpoint() | 82 ~RecursionCheckpoint() |
| 73 { | 83 { |
| 74 m_data->m_invalidationSets.remove(m_prevInvalidationSetsSize, m_data ->m_invalidationSets.size() - m_prevInvalidationSetsSize); | 84 m_data->m_invalidationSets.remove(m_prevInvalidationSetsSize, m_data ->m_invalidationSets.size() - m_prevInvalidationSetsSize); |
| 75 m_data->m_invalidateCustomPseudo = m_prevInvalidateCustomPseudo; | 85 m_data->m_invalidateCustomPseudo = m_prevInvalidateCustomPseudo; |
| 76 m_data->m_wholeSubtreeInvalid = m_prevWholeSubtreeInvalid; | 86 m_data->m_wholeSubtreeInvalid = m_prevWholeSubtreeInvalid; |
| 77 m_data->m_treeBoundaryCrossing = m_treeBoundaryCrossing; | 87 m_data->m_treeBoundaryCrossing = m_treeBoundaryCrossing; |
| 78 m_data->m_insertionPointCrossing = m_insertionPointCrossing; | 88 m_data->m_insertionPointCrossing = m_insertionPointCrossing; |
| 79 } | 89 } |
| 80 | 90 |
| 81 private: | 91 private: |
| 82 int m_prevInvalidationSetsSize; | 92 int m_prevInvalidationSetsSize; |
| 83 bool m_prevInvalidateCustomPseudo; | 93 bool m_prevInvalidateCustomPseudo; |
| 84 bool m_prevWholeSubtreeInvalid; | 94 bool m_prevWholeSubtreeInvalid; |
| 85 bool m_treeBoundaryCrossing; | 95 bool m_treeBoundaryCrossing; |
| 86 bool m_insertionPointCrossing; | 96 bool m_insertionPointCrossing; |
| 87 RecursionData* m_data; | 97 RecursionData* m_data; |
|
sof
2015/07/22 06:08:42
Add a comment saying that this is stack reference,
keishi
2015/07/22 06:30:47
Done.
| |
| 88 }; | 98 }; |
| 89 | 99 |
| 90 using InvalidationList = WillBeHeapVector<RefPtrWillBeMember<DescendantInval idationSet>>; | 100 using InvalidationList = WillBeHeapVector<RefPtrWillBeMember<DescendantInval idationSet>>; |
| 91 using PendingInvalidationMap = WillBeHeapHashMap<RawPtrWillBeMember<Element> , OwnPtrWillBeMember<InvalidationList>>; | 101 using PendingInvalidationMap = WillBeHeapHashMap<RawPtrWillBeMember<Element> , OwnPtrWillBeMember<InvalidationList>>; |
| 92 | 102 |
| 93 InvalidationList& ensurePendingInvalidationList(Element&); | 103 InvalidationList& ensurePendingInvalidationList(Element&); |
| 94 | 104 |
| 95 PendingInvalidationMap m_pendingInvalidationMap; | 105 PendingInvalidationMap m_pendingInvalidationMap; |
| 96 }; | 106 }; |
| 97 | 107 |
| 98 } // namespace blink | 108 } // namespace blink |
| 99 | 109 |
| 100 #endif // StyleInvalidator_h | 110 #endif // StyleInvalidator_h |
| OLD | NEW |