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 #include "config.h" | 5 #include "config.h" |
6 #include "platform/graphics/paint/DisplayItemList.h" | 6 #include "platform/graphics/paint/DisplayItemList.h" |
7 | 7 |
8 #include "platform/NotImplemented.h" | 8 #include "platform/NotImplemented.h" |
9 #include "platform/RuntimeEnabledFeatures.h" | 9 #include "platform/RuntimeEnabledFeatures.h" |
10 #include "platform/TraceEvent.h" | 10 #include "platform/TraceEvent.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // Update the existing display items by removing invalidated entries, updating | 216 // Update the existing display items by removing invalidated entries, updating |
217 // repainted ones, and appending new items. | 217 // repainted ones, and appending new items. |
218 // - For CachedDisplayItem, copy the corresponding cached DrawingDisplayItem; | 218 // - For CachedDisplayItem, copy the corresponding cached DrawingDisplayItem; |
219 // - For SubtreeCachedDisplayItem, copy the cached display items between the | 219 // - For SubtreeCachedDisplayItem, copy the cached display items between the |
220 // corresponding BeginSubtreeDisplayItem and EndSubtreeDisplayItem (incl.); | 220 // corresponding BeginSubtreeDisplayItem and EndSubtreeDisplayItem (incl.); |
221 // - Otherwise, copy the new display item. | 221 // - Otherwise, copy the new display item. |
222 // | 222 // |
223 // The algorithm is O(|m_currentDisplayItems| + |m_newDisplayItems|). | 223 // The algorithm is O(|m_currentDisplayItems| + |m_newDisplayItems|). |
224 // Coefficients are related to the ratio of out-of-order [Subtree]CachedDisplayI
tems | 224 // Coefficients are related to the ratio of out-of-order [Subtree]CachedDisplayI
tems |
225 // and the average number of (Drawing|BeginSubtree)DisplayItems per client. | 225 // and the average number of (Drawing|BeginSubtree)DisplayItems per client. |
226 void DisplayItemList::commitNewDisplayItems() | 226 // |
| 227 // TODO(pdr): Implement the DisplayListDiff algorithm for SlimmingPaintV2. |
| 228 void DisplayItemList::commitNewDisplayItems(DisplayListDiff*) |
227 { | 229 { |
228 TRACE_EVENT2("blink,benchmark", "DisplayItemList::commitNewDisplayItems", "c
urrent_display_list_size", (int)m_currentDisplayItems.size(), | 230 TRACE_EVENT2("blink,benchmark", "DisplayItemList::commitNewDisplayItems", "c
urrent_display_list_size", (int)m_currentDisplayItems.size(), |
229 "num_non_cached_new_items", (int)m_newDisplayItems.size() - m_numCachedI
tems); | 231 "num_non_cached_new_items", (int)m_newDisplayItems.size() - m_numCachedI
tems); |
230 | 232 |
231 // These data structures are used during painting only. | 233 // These data structures are used during painting only. |
232 ASSERT(m_scopeStack.isEmpty()); | 234 ASSERT(m_scopeStack.isEmpty()); |
233 m_scopeStack.clear(); | 235 m_scopeStack.clear(); |
234 m_nextScope = 1; | 236 m_nextScope = 1; |
235 ASSERT(!skippingCache()); | 237 ASSERT(!skippingCache()); |
236 #if ENABLE(ASSERT) | 238 #if ENABLE(ASSERT) |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 DisplayItemClient lastClient = nullptr; | 376 DisplayItemClient lastClient = nullptr; |
375 for (const DisplayItem& displayItem : m_currentDisplayItems) { | 377 for (const DisplayItem& displayItem : m_currentDisplayItems) { |
376 if (displayItem.client() == lastClient) | 378 if (displayItem.client() == lastClient) |
377 continue; | 379 continue; |
378 lastClient = displayItem.client(); | 380 lastClient = displayItem.client(); |
379 if (!displayItem.skippedCache()) | 381 if (!displayItem.skippedCache()) |
380 m_validlyCachedClients.add(lastClient); | 382 m_validlyCachedClients.add(lastClient); |
381 } | 383 } |
382 } | 384 } |
383 | 385 |
| 386 void DisplayItemList::appendToWebDisplayItemList(WebDisplayItemList* list) |
| 387 { |
| 388 for (const DisplayItem& item : m_currentDisplayItems) |
| 389 item.appendToWebDisplayItemList(list); |
| 390 } |
| 391 |
384 void DisplayItemList::commitNewDisplayItemsAndAppendToWebDisplayItemList(WebDisp
layItemList* list) | 392 void DisplayItemList::commitNewDisplayItemsAndAppendToWebDisplayItemList(WebDisp
layItemList* list) |
385 { | 393 { |
386 commitNewDisplayItems(); | 394 commitNewDisplayItems(); |
387 for (const DisplayItem& item : m_currentDisplayItems) | 395 appendToWebDisplayItemList(list); |
388 item.appendToWebDisplayItemList(list); | |
389 } | 396 } |
390 | 397 |
391 #if ENABLE(ASSERT) | 398 #if ENABLE(ASSERT) |
392 | 399 |
393 static void showUnderInvalidationError(const char* reason, const DisplayItem& di
splayItem) | 400 static void showUnderInvalidationError(const char* reason, const DisplayItem& di
splayItem) |
394 { | 401 { |
395 #ifndef NDEBUG | 402 #ifndef NDEBUG |
396 WTFLogAlways("%s: %s\nSee http://crbug.com/450725.", reason, displayItem.asD
ebugString().utf8().data()); | 403 WTFLogAlways("%s: %s\nSee http://crbug.com/450725.", reason, displayItem.asD
ebugString().utf8().data()); |
397 #else | 404 #else |
398 WTFLogAlways("%s. Run debug build to get more details\nSee http://crbug.com/
450725.", reason); | 405 WTFLogAlways("%s. Run debug build to get more details\nSee http://crbug.com/
450725.", reason); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 538 |
532 void DisplayItemList::replay(GraphicsContext& context) | 539 void DisplayItemList::replay(GraphicsContext& context) |
533 { | 540 { |
534 TRACE_EVENT0("blink,benchmark", "DisplayItemList::replay"); | 541 TRACE_EVENT0("blink,benchmark", "DisplayItemList::replay"); |
535 ASSERT(m_newDisplayItems.isEmpty()); | 542 ASSERT(m_newDisplayItems.isEmpty()); |
536 for (DisplayItem& displayItem : m_currentDisplayItems) | 543 for (DisplayItem& displayItem : m_currentDisplayItems) |
537 displayItem.replay(context); | 544 displayItem.replay(context); |
538 } | 545 } |
539 | 546 |
540 } // namespace blink | 547 } // namespace blink |
OLD | NEW |