| 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/graphics/ContiguousContainer.h" | 10 #include "platform/graphics/ContiguousContainer.h" |
| 10 #include "platform/graphics/paint/DisplayItem.h" | 11 #include "platform/graphics/paint/DisplayItem.h" |
| 11 #include "platform/graphics/paint/Transform3DDisplayItem.h" | 12 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
| 12 #include "wtf/Alignment.h" | 13 #include "wtf/Alignment.h" |
| 13 #include "wtf/HashMap.h" | 14 #include "wtf/HashMap.h" |
| 14 #include "wtf/PassOwnPtr.h" | 15 #include "wtf/PassOwnPtr.h" |
| 15 #include "wtf/Utility.h" | 16 #include "wtf/Utility.h" |
| 16 #include "wtf/Vector.h" | 17 #include "wtf/Vector.h" |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 36 class PLATFORM_EXPORT DisplayItemList { | 37 class PLATFORM_EXPORT DisplayItemList { |
| 37 WTF_MAKE_NONCOPYABLE(DisplayItemList); | 38 WTF_MAKE_NONCOPYABLE(DisplayItemList); |
| 38 WTF_MAKE_FAST_ALLOCATED(DisplayItemList); | 39 WTF_MAKE_FAST_ALLOCATED(DisplayItemList); |
| 39 public: | 40 public: |
| 40 static PassOwnPtr<DisplayItemList> create() | 41 static PassOwnPtr<DisplayItemList> create() |
| 41 { | 42 { |
| 42 return adoptPtr(new DisplayItemList()); | 43 return adoptPtr(new DisplayItemList()); |
| 43 } | 44 } |
| 44 | 45 |
| 45 // These methods are called during paint invalidation. | 46 // These methods are called during paint invalidation. |
| 46 void invalidate(DisplayItemClient); | 47 void invalidate(const DisplayItemClientWrapper&); |
| 48 void invalidateUntracked(DisplayItemClient); |
| 47 void invalidateAll(); | 49 void invalidateAll(); |
| 48 | 50 |
| 49 // These methods are called during painting. | 51 // These methods are called during painting. |
| 50 template <typename DisplayItemClass, typename... Args> | 52 template <typename DisplayItemClass, typename... Args> |
| 51 DisplayItemClass& createAndAppend(Args&&... args) | 53 DisplayItemClass& createAndAppend(Args&&... args) |
| 52 { | 54 { |
| 53 static_assert(WTF::IsSubclass<DisplayItemClass, DisplayItem>::value, | 55 static_assert(WTF::IsSubclass<DisplayItemClass, DisplayItem>::value, |
| 54 "Can only createAndAppend subclasses of DisplayItem."); | 56 "Can only createAndAppend subclasses of DisplayItem."); |
| 55 static_assert(sizeof(DisplayItemClass) <= kMaximumDisplayItemSize, | 57 static_assert(sizeof(DisplayItemClass) <= kMaximumDisplayItemSize, |
| 56 "DisplayItem subclass is larger than kMaximumDisplayItemSize."); | 58 "DisplayItem subclass is larger than kMaximumDisplayItemSize."); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 void setDisplayItemConstructionIsDisabled(const bool disable) { m_constructi
onDisabled = disable; } | 104 void setDisplayItemConstructionIsDisabled(const bool disable) { m_constructi
onDisabled = disable; } |
| 103 | 105 |
| 104 #if ENABLE(ASSERT) | 106 #if ENABLE(ASSERT) |
| 105 size_t newDisplayItemsSize() const { return m_newDisplayItems.size(); } | 107 size_t newDisplayItemsSize() const { return m_newDisplayItems.size(); } |
| 106 #endif | 108 #endif |
| 107 | 109 |
| 108 #ifndef NDEBUG | 110 #ifndef NDEBUG |
| 109 void showDebugData() const; | 111 void showDebugData() const; |
| 110 #endif | 112 #endif |
| 111 | 113 |
| 114 void startTrackingPaintInvalidationObjects() |
| 115 { |
| 116 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 117 m_trackedPaintInvalidationObjects = adoptPtr(new Vector<String>()); |
| 118 } |
| 119 void stopTrackingPaintInvalidationObjects() |
| 120 { |
| 121 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 122 m_trackedPaintInvalidationObjects = nullptr; |
| 123 } |
| 124 Vector<String> trackedPaintInvalidationObjects() |
| 125 { |
| 126 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 127 return m_trackedPaintInvalidationObjects ? *m_trackedPaintInvalidationOb
jects : Vector<String>(); |
| 128 } |
| 129 |
| 112 protected: | 130 protected: |
| 113 DisplayItemList() | 131 DisplayItemList() |
| 114 : m_currentDisplayItems(kMaximumDisplayItemSize, 0) | 132 : m_currentDisplayItems(kMaximumDisplayItemSize, 0) |
| 115 , m_newDisplayItems(kMaximumDisplayItemSize, kInitialDisplayItemsCapacit
y * kMaximumDisplayItemSize) | 133 , m_newDisplayItems(kMaximumDisplayItemSize, kInitialDisplayItemsCapacit
y * kMaximumDisplayItemSize) |
| 116 , m_validlyCachedClientsDirty(false) | 134 , m_validlyCachedClientsDirty(false) |
| 117 , m_constructionDisabled(false) | 135 , m_constructionDisabled(false) |
| 118 , m_skippingCacheCount(0) | 136 , m_skippingCacheCount(0) |
| 119 , m_numCachedItems(0) | 137 , m_numCachedItems(0) |
| 120 , m_nextScope(1) { } | 138 , m_nextScope(1) { } |
| 121 | 139 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 194 |
| 177 unsigned m_nextScope; | 195 unsigned m_nextScope; |
| 178 Vector<unsigned> m_scopeStack; | 196 Vector<unsigned> m_scopeStack; |
| 179 | 197 |
| 180 #if ENABLE(ASSERT) | 198 #if ENABLE(ASSERT) |
| 181 // This is used to check duplicated ids during add(). We could also check du
ring | 199 // This is used to check duplicated ids during add(). We could also check du
ring |
| 182 // updatePaintList(), but checking during add() helps developer easily find
where | 200 // updatePaintList(), but checking during add() helps developer easily find
where |
| 183 // the duplicated ids are from. | 201 // the duplicated ids are from. |
| 184 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; | 202 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; |
| 185 #endif | 203 #endif |
| 204 |
| 205 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; |
| 186 }; | 206 }; |
| 187 | 207 |
| 188 } // namespace blink | 208 } // namespace blink |
| 189 | 209 |
| 190 #endif // DisplayItemList_h | 210 #endif // DisplayItemList_h |
| OLD | NEW |