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" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 { | 146 { |
147 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 147 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
148 m_trackedPaintInvalidationObjects = nullptr; | 148 m_trackedPaintInvalidationObjects = nullptr; |
149 } | 149 } |
150 Vector<String> trackedPaintInvalidationObjects() | 150 Vector<String> trackedPaintInvalidationObjects() |
151 { | 151 { |
152 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 152 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
153 return m_trackedPaintInvalidationObjects ? *m_trackedPaintInvalidationOb
jects : Vector<String>(); | 153 return m_trackedPaintInvalidationObjects ? *m_trackedPaintInvalidationOb
jects : Vector<String>(); |
154 } | 154 } |
155 | 155 |
| 156 bool clientHasCheckedPaintInvalidation(DisplayItemClient client) const |
| 157 { |
| 158 ASSERT(RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled(
)); |
| 159 return m_clientsCheckedPaintInvalidation.contains(client); |
| 160 } |
| 161 void setClientHasCheckedPaintInvalidation(DisplayItemClient client) |
| 162 { |
| 163 ASSERT(RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled(
)); |
| 164 m_clientsCheckedPaintInvalidation.add(client); |
| 165 } |
| 166 |
156 protected: | 167 protected: |
157 DisplayItemList() | 168 DisplayItemList() |
158 : m_currentDisplayItems(0) | 169 : m_currentDisplayItems(0) |
159 , m_newDisplayItems(kInitialDisplayItemsCapacity * kMaximumDisplayItemSi
ze) | 170 , m_newDisplayItems(kInitialDisplayItemsCapacity * kMaximumDisplayItemSi
ze) |
160 , m_validlyCachedClientsDirty(false) | 171 , m_validlyCachedClientsDirty(false) |
161 , m_constructionDisabled(false) | 172 , m_constructionDisabled(false) |
162 , m_skippingCacheCount(0) | 173 , m_skippingCacheCount(0) |
163 , m_numCachedItems(0) | 174 , m_numCachedItems(0) |
164 , m_nextScope(1) { } | 175 , m_nextScope(1) { } |
165 | 176 |
166 private: | 177 private: |
167 // Set new item state (scopes, cache skipping, etc) for a new item. | 178 // Set new item state (scopes, cache skipping, etc) for a new item. |
168 void processNewItem(DisplayItem&); | 179 void processNewItem(DisplayItem&); |
169 | 180 |
170 void updateValidlyCachedClientsIfNeeded() const; | 181 void updateValidlyCachedClientsIfNeeded() const; |
171 | 182 |
| 183 void invalidateClient(const DisplayItemClientWrapper&); |
| 184 |
172 #ifndef NDEBUG | 185 #ifndef NDEBUG |
173 WTF::String displayItemsAsDebugString(const DisplayItems&) const; | 186 WTF::String displayItemsAsDebugString(const DisplayItems&) const; |
174 #endif | 187 #endif |
175 | 188 |
176 // Indices into PaintList of all DrawingDisplayItems and BeginSubsequenceDis
playItems of each client. | 189 // Indices into PaintList of all DrawingDisplayItems and BeginSubsequenceDis
playItems of each client. |
177 // Temporarily used during merge to find out-of-order display items. | 190 // Temporarily used during merge to find out-of-order display items. |
178 using DisplayItemIndicesByClientMap = HashMap<DisplayItemClient, Vector<size
_t>>; | 191 using DisplayItemIndicesByClientMap = HashMap<DisplayItemClient, Vector<size
_t>>; |
179 | 192 |
180 static size_t findMatchingItemFromIndex(const DisplayItem::Id&, const Displa
yItemIndicesByClientMap&, const DisplayItems&); | 193 static size_t findMatchingItemFromIndex(const DisplayItem::Id&, const Displa
yItemIndicesByClientMap&, const DisplayItems&); |
181 static void addItemToIndexIfNeeded(const DisplayItem&, size_t index, Display
ItemIndicesByClientMap&); | 194 static void addItemToIndexIfNeeded(const DisplayItem&, size_t index, Display
ItemIndicesByClientMap&); |
(...skipping 11 matching lines...) Expand all Loading... |
193 void checkNoRemainingCachedDisplayItems(); | 206 void checkNoRemainingCachedDisplayItems(); |
194 #endif | 207 #endif |
195 | 208 |
196 void replay(GraphicsContext&); | 209 void replay(GraphicsContext&); |
197 | 210 |
198 DisplayItems m_currentDisplayItems; | 211 DisplayItems m_currentDisplayItems; |
199 DisplayItems m_newDisplayItems; | 212 DisplayItems m_newDisplayItems; |
200 | 213 |
201 // Contains all clients having valid cached paintings if updated. | 214 // Contains all clients having valid cached paintings if updated. |
202 // It's lazily updated in updateValidlyCachedClientsIfNeeded(). | 215 // It's lazily updated in updateValidlyCachedClientsIfNeeded(). |
203 // FIXME: In the future we can replace this with client-side repaint flags | 216 // TODO(wangxianzhu): In the future we can replace this with client-side rep
aint flags |
204 // to avoid the cost of building and querying the hash table. | 217 // to avoid the cost of building and querying the hash table. |
205 mutable HashSet<DisplayItemClient> m_validlyCachedClients; | 218 mutable HashSet<DisplayItemClient> m_validlyCachedClients; |
206 mutable bool m_validlyCachedClientsDirty; | 219 mutable bool m_validlyCachedClientsDirty; |
207 | 220 |
| 221 // Used during painting. Contains clients that have checked paint invalidati
on and |
| 222 // are known to be valid. |
| 223 // TODO(wangxianzhu): Use client side flag to avoid const of hash table. |
| 224 HashSet<DisplayItemClient> m_clientsCheckedPaintInvalidation; |
| 225 |
208 #if ENABLE(ASSERT) | 226 #if ENABLE(ASSERT) |
209 // Set of clients which had paint offset changes since the last commit. This
is used for | 227 // 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. | 228 // ensuring paint offsets are only updated once and are the same in all phas
es. |
211 HashSet<DisplayItemClient> m_clientsWithPaintOffsetInvalidations; | 229 HashSet<DisplayItemClient> m_clientsWithPaintOffsetInvalidations; |
212 #endif | 230 #endif |
213 | 231 |
214 // Allow display item construction to be disabled to isolate the costs of co
nstruction | 232 // Allow display item construction to be disabled to isolate the costs of co
nstruction |
215 // in performance metrics. | 233 // in performance metrics. |
216 bool m_constructionDisabled; | 234 bool m_constructionDisabled; |
217 | 235 |
(...skipping 17 matching lines...) Expand all Loading... |
235 // the duplicated ids are from. | 253 // the duplicated ids are from. |
236 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; | 254 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; |
237 #endif | 255 #endif |
238 | 256 |
239 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; | 257 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; |
240 }; | 258 }; |
241 | 259 |
242 } // namespace blink | 260 } // namespace blink |
243 | 261 |
244 #endif // DisplayItemList_h | 262 #endif // DisplayItemList_h |
OLD | NEW |