| 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 15 matching lines...) Expand all Loading... |
| 26 // Currently the limiting factor is TransformtionMatrix (in | 26 // Currently the limiting factor is TransformtionMatrix (in |
| 27 // BeginTransform3DDisplayItem), which requests 16-byte alignment. | 27 // BeginTransform3DDisplayItem), which requests 16-byte alignment. |
| 28 static const size_t kDisplayItemAlignment = WTF_ALIGN_OF(BeginTransform3DDisplay
Item); | 28 static const size_t kDisplayItemAlignment = WTF_ALIGN_OF(BeginTransform3DDisplay
Item); |
| 29 static const size_t kInitialDisplayItemsCapacity = 64; | 29 static const size_t kInitialDisplayItemsCapacity = 64; |
| 30 static const size_t kMaximumDisplayItemSize = sizeof(BeginTransform3DDisplayItem
); | 30 static const size_t kMaximumDisplayItemSize = sizeof(BeginTransform3DDisplayItem
); |
| 31 | 31 |
| 32 // Map from SimpleLayer.startPoint to the DrawingDisplayItems within its range | 32 // Map from SimpleLayer.startPoint to the DrawingDisplayItems within its range |
| 33 // which were invalidated on this frame and do not change SimpleLayers. | 33 // which were invalidated on this frame and do not change SimpleLayers. |
| 34 using DisplayListDiff = HashMap<DisplayItemClient, DisplayItem*>; | 34 using DisplayListDiff = HashMap<DisplayItemClient, DisplayItem*>; |
| 35 | 35 |
| 36 using DisplayItems = ContiguousContainer<DisplayItem, kDisplayItemAlignment>; | 36 class DisplayItems : public ContiguousContainer<DisplayItem, kDisplayItemAlignme
nt> { |
| 37 public: |
| 38 DisplayItems(size_t initialSizeBytes) |
| 39 : ContiguousContainer(kMaximumDisplayItemSize, initialSizeBytes) {} |
| 40 |
| 41 DisplayItem& appendByMoving(DisplayItem& item) |
| 42 { |
| 43 #ifndef NDEBUG |
| 44 WTF::String originalDebugString = item.asDebugString(); |
| 45 #endif |
| 46 DisplayItem& result = ContiguousContainer::appendByMoving(item, item.der
ivedSize()); |
| 47 // ContiguousContainer::appendByMoving() called in-place constructor on
item, which invalidated it. |
| 48 ASSERT(!item.isValid()); |
| 49 #ifndef NDEBUG |
| 50 // Save original debug string in the old item to help debugging. |
| 51 item.setClientDebugString(originalDebugString); |
| 52 #endif |
| 53 return result; |
| 54 } |
| 55 }; |
| 37 | 56 |
| 38 class PLATFORM_EXPORT DisplayItemList { | 57 class PLATFORM_EXPORT DisplayItemList { |
| 39 WTF_MAKE_NONCOPYABLE(DisplayItemList); | 58 WTF_MAKE_NONCOPYABLE(DisplayItemList); |
| 40 WTF_MAKE_FAST_ALLOCATED(DisplayItemList); | 59 WTF_MAKE_FAST_ALLOCATED(DisplayItemList); |
| 41 public: | 60 public: |
| 42 static PassOwnPtr<DisplayItemList> create() | 61 static PassOwnPtr<DisplayItemList> create() |
| 43 { | 62 { |
| 44 return adoptPtr(new DisplayItemList()); | 63 return adoptPtr(new DisplayItemList()); |
| 45 } | 64 } |
| 46 | 65 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 m_trackedPaintInvalidationObjects = nullptr; | 153 m_trackedPaintInvalidationObjects = nullptr; |
| 135 } | 154 } |
| 136 Vector<String> trackedPaintInvalidationObjects() | 155 Vector<String> trackedPaintInvalidationObjects() |
| 137 { | 156 { |
| 138 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 157 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 139 return m_trackedPaintInvalidationObjects ? *m_trackedPaintInvalidationOb
jects : Vector<String>(); | 158 return m_trackedPaintInvalidationObjects ? *m_trackedPaintInvalidationOb
jects : Vector<String>(); |
| 140 } | 159 } |
| 141 | 160 |
| 142 protected: | 161 protected: |
| 143 DisplayItemList() | 162 DisplayItemList() |
| 144 : m_currentDisplayItems(kMaximumDisplayItemSize, 0) | 163 : m_currentDisplayItems(0) |
| 145 , m_newDisplayItems(kMaximumDisplayItemSize, kInitialDisplayItemsCapacit
y * kMaximumDisplayItemSize) | 164 , m_newDisplayItems(kInitialDisplayItemsCapacity * kMaximumDisplayItemSi
ze) |
| 146 , m_validlyCachedClientsDirty(false) | 165 , m_validlyCachedClientsDirty(false) |
| 147 , m_constructionDisabled(false) | 166 , m_constructionDisabled(false) |
| 148 , m_skippingCacheCount(0) | 167 , m_skippingCacheCount(0) |
| 149 , m_numCachedItems(0) | 168 , m_numCachedItems(0) |
| 150 , m_nextScope(1) { } | 169 , m_nextScope(1) { } |
| 151 | 170 |
| 152 private: | 171 private: |
| 153 friend class DisplayItemListTest; | 172 friend class DisplayItemListTest; |
| 154 friend class DisplayItemListPaintTest; | 173 friend class DisplayItemListPaintTest; |
| 155 friend class DisplayItemListPaintTestForSlimmingPaintV2; | 174 friend class DisplayItemListPaintTestForSlimmingPaintV2; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // the duplicated ids are from. | 250 // the duplicated ids are from. |
| 232 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; | 251 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; |
| 233 #endif | 252 #endif |
| 234 | 253 |
| 235 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; | 254 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; |
| 236 }; | 255 }; |
| 237 | 256 |
| 238 } // namespace blink | 257 } // namespace blink |
| 239 | 258 |
| 240 #endif // DisplayItemList_h | 259 #endif // DisplayItemList_h |
| OLD | NEW |