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