| 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" |
| 11 #include "platform/graphics/ContiguousContainer.h" | 11 #include "platform/graphics/ContiguousContainer.h" |
| 12 #include "platform/graphics/paint/DisplayItem.h" | 12 #include "platform/graphics/paint/DisplayItem.h" |
| 13 #include "platform/graphics/paint/PaintChunk.h" |
| 14 #include "platform/graphics/paint/PaintChunker.h" |
| 13 #include "platform/graphics/paint/Transform3DDisplayItem.h" | 15 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
| 14 #include "wtf/Alignment.h" | 16 #include "wtf/Alignment.h" |
| 15 #include "wtf/HashMap.h" | 17 #include "wtf/HashMap.h" |
| 16 #include "wtf/PassOwnPtr.h" | 18 #include "wtf/PassOwnPtr.h" |
| 17 #include "wtf/Utility.h" | 19 #include "wtf/Utility.h" |
| 18 #include "wtf/Vector.h" | 20 #include "wtf/Vector.h" |
| 19 | 21 |
| 20 namespace blink { | 22 namespace blink { |
| 21 | 23 |
| 22 class GraphicsContext; | 24 class GraphicsContext; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 void invalidateUntracked(DisplayItemClient); | 71 void invalidateUntracked(DisplayItemClient); |
| 70 void invalidateAll(); | 72 void invalidateAll(); |
| 71 | 73 |
| 72 // Record when paint offsets change during paint. | 74 // Record when paint offsets change during paint. |
| 73 void invalidatePaintOffset(const DisplayItemClientWrapper&); | 75 void invalidatePaintOffset(const DisplayItemClientWrapper&); |
| 74 #if ENABLE(ASSERT) | 76 #if ENABLE(ASSERT) |
| 75 bool paintOffsetWasInvalidated(DisplayItemClient) const; | 77 bool paintOffsetWasInvalidated(DisplayItemClient) const; |
| 76 #endif | 78 #endif |
| 77 | 79 |
| 78 // These methods are called during painting. | 80 // These methods are called during painting. |
| 81 |
| 82 // Provide a new set of paint properties to apply to recorded display items, |
| 83 // for Slimming Paint v2. |
| 84 void updateCurrentPaintProperties(const PaintProperties&); |
| 85 |
| 79 template <typename DisplayItemClass, typename... Args> | 86 template <typename DisplayItemClass, typename... Args> |
| 80 DisplayItemClass& createAndAppend(Args&&... args) | 87 DisplayItemClass& createAndAppend(Args&&... args) |
| 81 { | 88 { |
| 82 static_assert(WTF::IsSubclass<DisplayItemClass, DisplayItem>::value, | 89 static_assert(WTF::IsSubclass<DisplayItemClass, DisplayItem>::value, |
| 83 "Can only createAndAppend subclasses of DisplayItem."); | 90 "Can only createAndAppend subclasses of DisplayItem."); |
| 84 static_assert(sizeof(DisplayItemClass) <= kMaximumDisplayItemSize, | 91 static_assert(sizeof(DisplayItemClass) <= kMaximumDisplayItemSize, |
| 85 "DisplayItem subclass is larger than kMaximumDisplayItemSize."); | 92 "DisplayItem subclass is larger than kMaximumDisplayItemSize."); |
| 86 | 93 |
| 87 DisplayItemClass& displayItem = m_newDisplayItems.allocateAndConstruct<D
isplayItemClass>(WTF::forward<Args>(args)...); | 94 DisplayItemClass& displayItem = m_newDisplayItems.allocateAndConstruct<D
isplayItemClass>(WTF::forward<Args>(args)...); |
| 88 processNewItem(displayItem); | 95 processNewItem(displayItem); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 108 void commitNewDisplayItems(DisplayListDiff* = 0); | 115 void commitNewDisplayItems(DisplayListDiff* = 0); |
| 109 | 116 |
| 110 // Returns the approximate memory usage, excluding memory likely to be | 117 // Returns the approximate memory usage, excluding memory likely to be |
| 111 // shared with the embedder after copying to WebDisplayItemList. | 118 // shared with the embedder after copying to WebDisplayItemList. |
| 112 // Should only be called right after commitNewDisplayItems. | 119 // Should only be called right after commitNewDisplayItems. |
| 113 size_t approximateUnsharedMemoryUsage() const; | 120 size_t approximateUnsharedMemoryUsage() const; |
| 114 | 121 |
| 115 // Get the paint list generated after the last painting. | 122 // Get the paint list generated after the last painting. |
| 116 const DisplayItems& displayItems() const; | 123 const DisplayItems& displayItems() const; |
| 117 | 124 |
| 125 // Get the paint chunks generated after the last painting. |
| 126 const Vector<PaintChunk>& paintChunks() const; |
| 127 |
| 118 bool clientCacheIsValid(DisplayItemClient) const; | 128 bool clientCacheIsValid(DisplayItemClient) const; |
| 119 | 129 |
| 120 // Commits the new display items and plays back the updated display items in
to the given context. | 130 // Commits the new display items and plays back the updated display items in
to the given context. |
| 121 void commitNewDisplayItemsAndReplay(GraphicsContext& context) | 131 void commitNewDisplayItemsAndReplay(GraphicsContext& context) |
| 122 { | 132 { |
| 123 commitNewDisplayItems(); | 133 commitNewDisplayItems(); |
| 124 replay(context); | 134 replay(context); |
| 125 } | 135 } |
| 126 | 136 |
| 127 void appendToWebDisplayItemList(WebDisplayItemList*); | 137 void appendToWebDisplayItemList(WebDisplayItemList*); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 void checkUnderInvalidation(DisplayItems::iterator& newIt, DisplayItems::ite
rator& currentIt); | 202 void checkUnderInvalidation(DisplayItems::iterator& newIt, DisplayItems::ite
rator& currentIt); |
| 193 void checkCachedDisplayItemIsUnchanged(const char* messagePrefix, const Disp
layItem& newItem, const DisplayItem& oldItem); | 203 void checkCachedDisplayItemIsUnchanged(const char* messagePrefix, const Disp
layItem& newItem, const DisplayItem& oldItem); |
| 194 void checkNoRemainingCachedDisplayItems(); | 204 void checkNoRemainingCachedDisplayItems(); |
| 195 #endif | 205 #endif |
| 196 | 206 |
| 197 void replay(GraphicsContext&); | 207 void replay(GraphicsContext&); |
| 198 | 208 |
| 199 DisplayItems m_currentDisplayItems; | 209 DisplayItems m_currentDisplayItems; |
| 200 DisplayItems m_newDisplayItems; | 210 DisplayItems m_newDisplayItems; |
| 201 | 211 |
| 212 // In Slimming Paint v2, paint properties (e.g. transform) useful for |
| 213 // compositing are stored in corresponding paint chunks instead of in the |
| 214 // display items. |
| 215 Vector<PaintChunk> m_currentPaintChunks; |
| 216 PaintChunker m_newPaintChunks; |
| 217 |
| 202 // Contains all clients having valid cached paintings if updated. | 218 // Contains all clients having valid cached paintings if updated. |
| 203 // It's lazily updated in updateValidlyCachedClientsIfNeeded(). | 219 // It's lazily updated in updateValidlyCachedClientsIfNeeded(). |
| 204 // FIXME: In the future we can replace this with client-side repaint flags | 220 // FIXME: In the future we can replace this with client-side repaint flags |
| 205 // to avoid the cost of building and querying the hash table. | 221 // to avoid the cost of building and querying the hash table. |
| 206 mutable HashSet<DisplayItemClient> m_validlyCachedClients; | 222 mutable HashSet<DisplayItemClient> m_validlyCachedClients; |
| 207 mutable bool m_validlyCachedClientsDirty; | 223 mutable bool m_validlyCachedClientsDirty; |
| 208 | 224 |
| 209 #if ENABLE(ASSERT) | 225 #if ENABLE(ASSERT) |
| 210 // Set of clients which had paint offset changes since the last commit. This
is used for | 226 // Set of clients which had paint offset changes since the last commit. This
is used for |
| 211 // ensuring paint offsets are only updated once and are the same in all phas
es. | 227 // ensuring paint offsets are only updated once and are the same in all phas
es. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 229 // the duplicated ids are from. | 245 // the duplicated ids are from. |
| 230 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; | 246 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; |
| 231 #endif | 247 #endif |
| 232 | 248 |
| 233 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; | 249 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; |
| 234 }; | 250 }; |
| 235 | 251 |
| 236 } // namespace blink | 252 } // namespace blink |
| 237 | 253 |
| 238 #endif // DisplayItemList_h | 254 #endif // DisplayItemList_h |
| OLD | NEW |