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 DisplayItemList_h | 5 #ifndef DisplayItemList_h |
6 #define DisplayItemList_h | 6 #define DisplayItemList_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/RuntimeEnabledFeatures.h" | 9 #include "platform/RuntimeEnabledFeatures.h" |
10 #include "platform/geometry/LayoutPoint.h" | 10 #include "platform/geometry/LayoutPoint.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // These methods are called during painting. | 63 // These methods are called during painting. |
64 template <typename DisplayItemClass, typename... Args> | 64 template <typename DisplayItemClass, typename... Args> |
65 DisplayItemClass& createAndAppend(Args&&... args) | 65 DisplayItemClass& createAndAppend(Args&&... args) |
66 { | 66 { |
67 static_assert(WTF::IsSubclass<DisplayItemClass, DisplayItem>::value, | 67 static_assert(WTF::IsSubclass<DisplayItemClass, DisplayItem>::value, |
68 "Can only createAndAppend subclasses of DisplayItem."); | 68 "Can only createAndAppend subclasses of DisplayItem."); |
69 static_assert(sizeof(DisplayItemClass) <= kMaximumDisplayItemSize, | 69 static_assert(sizeof(DisplayItemClass) <= kMaximumDisplayItemSize, |
70 "DisplayItem subclass is larger than kMaximumDisplayItemSize."); | 70 "DisplayItem subclass is larger than kMaximumDisplayItemSize."); |
71 | 71 |
72 DisplayItemClass& displayItem = m_newDisplayItems.allocateAndConstruct<D
isplayItemClass>(WTF::forward<Args>(args)...); | 72 DisplayItemClass& displayItem = m_newDisplayItems.allocateAndConstruct<D
isplayItemClass>(WTF::forward<Args>(args)...); |
73 processNewItem(&displayItem); | 73 processNewItem(displayItem); |
74 return displayItem; | 74 return displayItem; |
75 } | 75 } |
76 | 76 |
77 // Scopes must be used to avoid duplicated display item ids when we paint so
me object | 77 // Scopes must be used to avoid duplicated display item ids when we paint so
me object |
78 // multiple times and generate multiple display items with the same type. | 78 // multiple times and generate multiple display items with the same type. |
79 // We don't cache display items added in scopes. | 79 // We don't cache display items added in scopes. |
80 void beginScope(); | 80 void beginScope(); |
81 void endScope(); | 81 void endScope(); |
82 | 82 |
83 // True if the last display item is a begin that doesn't draw content. | 83 // True if the last display item is a begin that doesn't draw content. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 , m_nextScope(1) { } | 150 , m_nextScope(1) { } |
151 | 151 |
152 private: | 152 private: |
153 friend class DisplayItemListTest; | 153 friend class DisplayItemListTest; |
154 friend class DisplayItemListPaintTest; | 154 friend class DisplayItemListPaintTest; |
155 friend class DisplayItemListPaintTestForSlimmingPaintV2; | 155 friend class DisplayItemListPaintTestForSlimmingPaintV2; |
156 friend class LayoutObjectDrawingRecorderTest; | 156 friend class LayoutObjectDrawingRecorderTest; |
157 friend class LayoutObjectDrawingRecorderTestForSlimmingPaintV2; | 157 friend class LayoutObjectDrawingRecorderTestForSlimmingPaintV2; |
158 | 158 |
159 // Set new item state (scopes, cache skipping, etc) for a new item. | 159 // Set new item state (scopes, cache skipping, etc) for a new item. |
160 // TODO(pdr): This only passes a pointer to make the patch easier to review.
Change to a reference. | 160 void processNewItem(DisplayItem&); |
161 void processNewItem(DisplayItem*); | |
162 | 161 |
163 void updateValidlyCachedClientsIfNeeded() const; | 162 void updateValidlyCachedClientsIfNeeded() const; |
164 | 163 |
165 // Update the recorded paint offsets to remove any items that no longer have | 164 // Update the recorded paint offsets to remove any items that no longer have |
166 // corresponding cached display items. | 165 // corresponding cached display items. |
167 // TODO(pdr): Remove this once the paint offset cache is on LayoutObject. | 166 // TODO(pdr): Remove this once the paint offset cache is on LayoutObject. |
168 void removeUnneededPaintOffsetEntries(); | 167 void removeUnneededPaintOffsetEntries(); |
169 | 168 |
170 #ifndef NDEBUG | 169 #ifndef NDEBUG |
171 WTF::String displayItemsAsDebugString(const DisplayItems&) const; | 170 WTF::String displayItemsAsDebugString(const DisplayItems&) const; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // the duplicated ids are from. | 231 // the duplicated ids are from. |
233 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; | 232 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; |
234 #endif | 233 #endif |
235 | 234 |
236 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; | 235 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; |
237 }; | 236 }; |
238 | 237 |
239 } // namespace blink | 238 } // namespace blink |
240 | 239 |
241 #endif // DisplayItemList_h | 240 #endif // DisplayItemList_h |
OLD | NEW |