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 "platform/graphics/paint/PaintController.h" | 5 #include "platform/graphics/paint/PaintController.h" |
6 | 6 |
7 #include "platform/graphics/GraphicsLayer.h" | 7 #include "platform/graphics/GraphicsLayer.h" |
8 #include "platform/graphics/paint/DrawingDisplayItem.h" | 8 #include "platform/graphics/paint/DrawingDisplayItem.h" |
9 #include "platform/instrumentation/tracing/TraceEvent.h" | 9 #include "platform/instrumentation/tracing/TraceEvent.h" |
10 #include "platform/wtf/AutoReset.h" | 10 #include "platform/wtf/AutoReset.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() && | 93 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() && |
94 isCheckingUnderInvalidation()) { | 94 isCheckingUnderInvalidation()) { |
95 // We are checking under-invalidation of an ancestor subsequence enclosing | 95 // We are checking under-invalidation of an ancestor subsequence enclosing |
96 // this one. The ancestor subsequence is supposed to have already "copied", | 96 // this one. The ancestor subsequence is supposed to have already "copied", |
97 // so we should let the client continue to actually paint the descendant | 97 // so we should let the client continue to actually paint the descendant |
98 // subsequences without "copying". | 98 // subsequences without "copying". |
99 return false; | 99 return false; |
100 } | 100 } |
101 | 101 |
102 size_t cachedItem = | 102 SubsequenceMarkers* markers = getSubsequenceMarkers(client); |
103 findCachedItem(DisplayItem::Id(client, DisplayItem::kSubsequence)); | 103 if (!markers) { |
104 if (cachedItem == kNotFound) { | |
105 NOTREACHED(); | |
106 return false; | 104 return false; |
107 } | 105 } |
108 | 106 |
109 // |cachedItem| will point to the first item after the subsequence or end of | 107 // |cachedItem| will point to the first item after the subsequence or end of |
110 // the current list. | 108 // the current list. |
111 ensureNewDisplayItemListInitialCapacity(); | 109 ensureNewDisplayItemListInitialCapacity(); |
112 copyCachedSubsequence(cachedItem); | |
113 | 110 |
114 m_nextItemToMatch = cachedItem; | 111 size_t sizeBeforeCopy = m_newDisplayItemList.size(); |
115 // Items before |cachedItem| have been copied so we don't need to index them. | 112 copyCachedSubsequence(markers->start, markers->end); |
116 if (cachedItem > m_nextItemToIndex) | 113 |
117 m_nextItemToIndex = cachedItem; | 114 if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
| 115 addCachedSubsequence(client, sizeBeforeCopy, |
| 116 m_newDisplayItemList.size() - 1); |
| 117 } |
| 118 |
| 119 m_nextItemToMatch = markers->end + 1; |
| 120 // Items before |m_nextItemToMatch| have been copied so we don't need to index |
| 121 // them. |
| 122 if (m_nextItemToMatch > m_nextItemToIndex) |
| 123 m_nextItemToIndex = m_nextItemToMatch; |
118 | 124 |
119 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 125 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
120 // Return false to let the painter actually paint. We will check if the new | 126 // Return false to let the painter actually paint. We will check if the new |
121 // painting is the same as the cached one. | 127 // painting is the same as the cached one. |
122 return false; | 128 return false; |
123 } | 129 } |
124 | 130 |
125 return true; | 131 return true; |
126 } | 132 } |
127 | 133 |
| 134 PaintController::SubsequenceMarkers* PaintController::getSubsequenceMarkers( |
| 135 const DisplayItemClient& client) { |
| 136 auto result = m_currentCachedSubsequences.find(&client); |
| 137 if (result == m_currentCachedSubsequences.end()) |
| 138 return nullptr; |
| 139 return &result->value; |
| 140 } |
| 141 |
| 142 void PaintController::addCachedSubsequence(const DisplayItemClient& client, |
| 143 unsigned start, |
| 144 unsigned end) { |
| 145 DCHECK(start <= end); |
| 146 DCHECK(end < m_newDisplayItemList.size()); |
| 147 if (isCheckingUnderInvalidation()) { |
| 148 SubsequenceMarkers* markers = getSubsequenceMarkers(client); |
| 149 if (!markers) { |
| 150 showSequenceUnderInvalidationError( |
| 151 "under-invalidation : unexpected subsequence", client, start, end); |
| 152 DCHECK(false); |
| 153 } |
| 154 if (markers->end - markers->start != end - start) { |
| 155 showSequenceUnderInvalidationError( |
| 156 "under-invalidation: new subsequence wrong length", client, start, |
| 157 end); |
| 158 DCHECK(false); |
| 159 } |
| 160 } |
| 161 |
| 162 DCHECK(m_newCachedSubsequences.find(&client) == |
| 163 m_newCachedSubsequences.end()); |
| 164 |
| 165 m_newCachedSubsequences.insert(&client, SubsequenceMarkers(start, end)); |
| 166 } |
| 167 |
128 bool PaintController::lastDisplayItemIsNoopBegin() const { | 168 bool PaintController::lastDisplayItemIsNoopBegin() const { |
129 if (m_newDisplayItemList.isEmpty()) | 169 if (m_newDisplayItemList.isEmpty()) |
130 return false; | 170 return false; |
131 | 171 |
132 const auto& lastDisplayItem = m_newDisplayItemList.last(); | 172 const auto& lastDisplayItem = m_newDisplayItemList.last(); |
133 return lastDisplayItem.isBegin() && !lastDisplayItem.drawsContent(); | 173 return lastDisplayItem.isBegin() && !lastDisplayItem.drawsContent(); |
134 } | 174 } |
135 | 175 |
136 void PaintController::removeLastDisplayItem() { | 176 void PaintController::removeLastDisplayItem() { |
137 if (m_newDisplayItemList.isEmpty()) | 177 if (m_newDisplayItemList.isEmpty()) |
(...skipping 25 matching lines...) Expand all Loading... |
163 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 203 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
164 m_newPaintChunks.decrementDisplayItemIndex(); | 204 m_newPaintChunks.decrementDisplayItemIndex(); |
165 } | 205 } |
166 | 206 |
167 const DisplayItem* PaintController::lastDisplayItem(unsigned offset) { | 207 const DisplayItem* PaintController::lastDisplayItem(unsigned offset) { |
168 if (offset < m_newDisplayItemList.size()) | 208 if (offset < m_newDisplayItemList.size()) |
169 return &m_newDisplayItemList[m_newDisplayItemList.size() - offset - 1]; | 209 return &m_newDisplayItemList[m_newDisplayItemList.size() - offset - 1]; |
170 return nullptr; | 210 return nullptr; |
171 } | 211 } |
172 | 212 |
| 213 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 214 void PaintController::beginShouldKeepAlive(const DisplayItemClient& client) { |
| 215 if (!isSkippingCache()) { |
| 216 // Mark the client shouldKeepAlive under this PaintController. |
| 217 // The status will end after the new display items are committed. |
| 218 client.beginShouldKeepAlive(this); |
| 219 |
| 220 if (!m_currentSubsequenceClients.isEmpty()) { |
| 221 // Mark the client shouldKeepAlive under the current subsequence. |
| 222 // The status will end when the subsequence owner is invalidated or |
| 223 // deleted. |
| 224 client.beginShouldKeepAlive(m_currentSubsequenceClients.back()); |
| 225 } |
| 226 } |
| 227 } |
| 228 #endif |
| 229 |
173 void PaintController::processNewItem(DisplayItem& displayItem) { | 230 void PaintController::processNewItem(DisplayItem& displayItem) { |
174 DCHECK(!m_constructionDisabled); | 231 DCHECK(!m_constructionDisabled); |
175 | 232 |
176 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 233 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
177 if (!isSkippingCache()) { | 234 if (displayItem.isCacheable()) { |
178 if (displayItem.isCacheable()) { | 235 beginShouldKeepAlive(displayItem.client()); |
179 // Mark the client shouldKeepAlive under this PaintController. | |
180 // The status will end after the new display items are committed. | |
181 displayItem.client().beginShouldKeepAlive(this); | |
182 | |
183 if (!m_currentSubsequenceClients.isEmpty()) { | |
184 // Mark the client shouldKeepAlive under the current subsequence. | |
185 // The status will end when the subsequence owner is invalidated or | |
186 // deleted. | |
187 displayItem.client().beginShouldKeepAlive( | |
188 m_currentSubsequenceClients.back()); | |
189 } | |
190 } | |
191 | |
192 if (displayItem.getType() == DisplayItem::kSubsequence) { | |
193 m_currentSubsequenceClients.push_back(&displayItem.client()); | |
194 } else if (displayItem.getType() == DisplayItem::kEndSubsequence) { | |
195 CHECK(m_currentSubsequenceClients.back() == &displayItem.client()); | |
196 m_currentSubsequenceClients.pop_back(); | |
197 } | |
198 } | 236 } |
199 #endif | 237 #endif |
200 | 238 |
201 if (isSkippingCache()) | 239 if (isSkippingCache()) |
202 displayItem.setSkippedCache(); | 240 displayItem.setSkippedCache(); |
203 | 241 |
204 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 242 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
205 size_t lastChunkIndex = m_newPaintChunks.lastChunkIndex(); | 243 size_t lastChunkIndex = m_newPaintChunks.lastChunkIndex(); |
206 if (m_newPaintChunks.incrementDisplayItemIndex(displayItem)) { | 244 if (m_newPaintChunks.incrementDisplayItemIndex(displayItem)) { |
207 DCHECK(lastChunkIndex != m_newPaintChunks.lastChunkIndex()); | 245 DCHECK(lastChunkIndex != m_newPaintChunks.lastChunkIndex()); |
208 if (lastChunkIndex != kNotFound) | 246 if (lastChunkIndex != kNotFound) |
209 generateChunkRasterInvalidationRects( | 247 generateChunkRasterInvalidationRects( |
210 m_newPaintChunks.paintChunkAt(lastChunkIndex)); | 248 m_newPaintChunks.paintChunkAt(lastChunkIndex)); |
211 } | 249 } |
212 } | 250 } |
213 | 251 |
214 #if DCHECK_IS_ON() | 252 #if DCHECK_IS_ON() |
215 // Verify noop begin/end pairs have been removed. | 253 // Verify noop begin/end pairs have been removed. |
216 if (m_newDisplayItemList.size() >= 2 && displayItem.isEnd()) { | 254 if (m_newDisplayItemList.size() >= 2 && displayItem.isEnd()) { |
217 const auto& beginDisplayItem = | 255 const auto& beginDisplayItem = |
218 m_newDisplayItemList[m_newDisplayItemList.size() - 2]; | 256 m_newDisplayItemList[m_newDisplayItemList.size() - 2]; |
219 if (beginDisplayItem.isBegin() && | 257 if (beginDisplayItem.isBegin() && |
220 beginDisplayItem.getType() != DisplayItem::kSubsequence && | |
221 !beginDisplayItem.drawsContent()) | 258 !beginDisplayItem.drawsContent()) |
222 DCHECK(!displayItem.isEndAndPairedWith(beginDisplayItem.getType())); | 259 DCHECK(!displayItem.isEndAndPairedWith(beginDisplayItem.getType())); |
223 } | 260 } |
224 | 261 |
225 size_t index = findMatchingItemFromIndex(displayItem.getId(), | 262 size_t index = findMatchingItemFromIndex(displayItem.getId(), |
226 m_newDisplayItemIndicesByClient, | 263 m_newDisplayItemIndicesByClient, |
227 m_newDisplayItemList); | 264 m_newDisplayItemList); |
228 if (index != kNotFound) { | 265 if (index != kNotFound) { |
229 #ifndef NDEBUG | 266 #ifndef NDEBUG |
230 showDebugData(); | 267 showDebugData(); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) | 423 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) |
387 CHECK(false) << "Can't find cached display item"; | 424 CHECK(false) << "Can't find cached display item"; |
388 | 425 |
389 // We did not find the cached display item. This should be impossible, but may | 426 // We did not find the cached display item. This should be impossible, but may |
390 // occur if there is a bug in the system, such as under-invalidation, | 427 // occur if there is a bug in the system, such as under-invalidation, |
391 // incorrect cache checking or duplicate display ids. In this case, the caller | 428 // incorrect cache checking or duplicate display ids. In this case, the caller |
392 // should fall back to repaint the display item. | 429 // should fall back to repaint the display item. |
393 return kNotFound; | 430 return kNotFound; |
394 } | 431 } |
395 | 432 |
396 // Copies a cached subsequence from current list to the new list. On return, | 433 // Copies a cached subsequence from current list to the new list. |
397 // |cachedItemIndex| points to the item after the EndSubsequence item of the | 434 // When paintUnderInvaldiationCheckingEnabled() we'll not actually |
398 // subsequence. When paintUnderInvaldiationCheckingEnabled() we'll not actually | |
399 // copy the subsequence, but mark the begin and end of the subsequence for | 435 // copy the subsequence, but mark the begin and end of the subsequence for |
400 // under-invalidation checking. | 436 // under-invalidation checking. |
401 void PaintController::copyCachedSubsequence(size_t& cachedItemIndex) { | 437 void PaintController::copyCachedSubsequence(size_t beginIndex, |
| 438 size_t endIndex) { |
402 AutoReset<size_t> subsequenceBeginIndex( | 439 AutoReset<size_t> subsequenceBeginIndex( |
403 &m_currentCachedSubsequenceBeginIndexInNewList, | 440 &m_currentCachedSubsequenceBeginIndexInNewList, |
404 m_newDisplayItemList.size()); | 441 m_newDisplayItemList.size()); |
405 DisplayItem* cachedItem = | 442 DisplayItem* cachedItem = |
406 &m_currentPaintArtifact.getDisplayItemList()[cachedItemIndex]; | 443 &m_currentPaintArtifact.getDisplayItemList()[beginIndex]; |
407 DCHECK(cachedItem->getType() == DisplayItem::kSubsequence); | |
408 | 444 |
409 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 445 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
410 DCHECK(!isCheckingUnderInvalidation()); | 446 DCHECK(!isCheckingUnderInvalidation()); |
411 m_underInvalidationCheckingBegin = cachedItemIndex; | 447 m_underInvalidationCheckingBegin = beginIndex; |
412 m_underInvalidationMessagePrefix = | 448 m_underInvalidationMessagePrefix = |
413 "(In cached subsequence of " + cachedItem->client().debugName() + ")"; | 449 "(In cached subsequence of " + cachedItem->client().debugName() + ")"; |
414 } | 450 } |
415 | 451 |
416 DisplayItem::Id endSubsequenceId(cachedItem->client(), | |
417 DisplayItem::kEndSubsequence); | |
418 Vector<PaintChunk>::const_iterator cachedChunk; | 452 Vector<PaintChunk>::const_iterator cachedChunk; |
419 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 453 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
420 cachedChunk = | 454 cachedChunk = |
421 m_currentPaintArtifact.findChunkByDisplayItemIndex(cachedItemIndex); | 455 m_currentPaintArtifact.findChunkByDisplayItemIndex(beginIndex); |
422 DCHECK(cachedChunk != m_currentPaintArtifact.paintChunks().end()); | 456 DCHECK(cachedChunk != m_currentPaintArtifact.paintChunks().end()); |
423 updateCurrentPaintChunkProperties( | 457 updateCurrentPaintChunkProperties( |
424 cachedChunk->id ? &*cachedChunk->id : nullptr, cachedChunk->properties); | 458 cachedChunk->id ? &*cachedChunk->id : nullptr, cachedChunk->properties); |
425 } else { | 459 } else { |
426 // Avoid uninitialized variable error on Windows. | 460 // Avoid uninitialized variable error on Windows. |
427 cachedChunk = m_currentPaintArtifact.paintChunks().begin(); | 461 cachedChunk = m_currentPaintArtifact.paintChunks().begin(); |
428 } | 462 } |
429 | 463 |
430 while (true) { | 464 for (size_t currentIndex = beginIndex; currentIndex <= endIndex; |
| 465 ++currentIndex) { |
| 466 cachedItem = &m_currentPaintArtifact.getDisplayItemList()[currentIndex]; |
431 DCHECK(cachedItem->hasValidClient()); | 467 DCHECK(cachedItem->hasValidClient()); |
432 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 468 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
433 CHECK(cachedItem->client().isAlive()); | 469 CHECK(cachedItem->client().isAlive()); |
434 #endif | 470 #endif |
435 ++m_numCachedNewItems; | 471 ++m_numCachedNewItems; |
436 bool metEndSubsequence = cachedItem->getId() == endSubsequenceId; | |
437 if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 472 if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
438 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 473 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
439 cachedItemIndex == cachedChunk->endIndex) { | 474 currentIndex == cachedChunk->endIndex) { |
440 ++cachedChunk; | 475 ++cachedChunk; |
441 DCHECK(cachedChunk != m_currentPaintArtifact.paintChunks().end()); | 476 DCHECK(cachedChunk != m_currentPaintArtifact.paintChunks().end()); |
442 updateCurrentPaintChunkProperties( | 477 updateCurrentPaintChunkProperties( |
443 cachedChunk->id ? &*cachedChunk->id : nullptr, | 478 cachedChunk->id ? &*cachedChunk->id : nullptr, |
444 cachedChunk->properties); | 479 cachedChunk->properties); |
445 } | 480 } |
446 processNewItem(moveItemFromCurrentListToNewList(cachedItemIndex)); | 481 processNewItem(moveItemFromCurrentListToNewList(currentIndex)); |
447 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 482 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
448 DCHECK((!m_newPaintChunks.lastChunk().id && !cachedChunk->id) || | 483 DCHECK((!m_newPaintChunks.lastChunk().id && !cachedChunk->id) || |
449 m_newPaintChunks.lastChunk().matches(*cachedChunk)); | 484 m_newPaintChunks.lastChunk().matches(*cachedChunk)); |
450 } | 485 } |
451 | |
452 ++cachedItemIndex; | |
453 if (metEndSubsequence) | |
454 break; | |
455 | |
456 // We should always be able to find the EndSubsequence display item. | |
457 DCHECK(cachedItemIndex < | |
458 m_currentPaintArtifact.getDisplayItemList().size()); | |
459 cachedItem = &m_currentPaintArtifact.getDisplayItemList()[cachedItemIndex]; | |
460 } | 486 } |
461 | 487 |
462 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 488 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
463 m_underInvalidationCheckingEnd = cachedItemIndex; | 489 m_underInvalidationCheckingEnd = endIndex + 1; |
464 DCHECK(isCheckingUnderInvalidation()); | 490 DCHECK(isCheckingUnderInvalidation()); |
465 } | 491 } |
466 } | 492 } |
467 | 493 |
468 DISABLE_CFI_PERF | 494 DISABLE_CFI_PERF |
469 static IntRect visualRectForDisplayItem( | 495 static IntRect visualRectForDisplayItem( |
470 const DisplayItem& displayItem, | 496 const DisplayItem& displayItem, |
471 const LayoutSize& offsetFromLayoutObject) { | 497 const LayoutSize& offsetFromLayoutObject) { |
472 LayoutRect visualRect = displayItem.client().visualRect(); | 498 LayoutRect visualRect = displayItem.client().visualRect(); |
473 visualRect.move(-offsetFromLayoutObject); | 499 visualRect.move(-offsetFromLayoutObject); |
(...skipping 11 matching lines...) Expand all Loading... |
485 | 511 |
486 DISABLE_CFI_PERF | 512 DISABLE_CFI_PERF |
487 void PaintController::commitNewDisplayItems( | 513 void PaintController::commitNewDisplayItems( |
488 const LayoutSize& offsetFromLayoutObject) { | 514 const LayoutSize& offsetFromLayoutObject) { |
489 TRACE_EVENT2("blink,benchmark", "PaintController::commitNewDisplayItems", | 515 TRACE_EVENT2("blink,benchmark", "PaintController::commitNewDisplayItems", |
490 "current_display_list_size", | 516 "current_display_list_size", |
491 (int)m_currentPaintArtifact.getDisplayItemList().size(), | 517 (int)m_currentPaintArtifact.getDisplayItemList().size(), |
492 "num_non_cached_new_items", | 518 "num_non_cached_new_items", |
493 (int)m_newDisplayItemList.size() - m_numCachedNewItems); | 519 (int)m_newDisplayItemList.size() - m_numCachedNewItems); |
494 m_numCachedNewItems = 0; | 520 m_numCachedNewItems = 0; |
495 | |
496 // These data structures are used during painting only. | 521 // These data structures are used during painting only. |
497 DCHECK(!isSkippingCache()); | 522 DCHECK(!isSkippingCache()); |
498 #if DCHECK_IS_ON() | 523 #if DCHECK_IS_ON() |
499 m_newDisplayItemIndicesByClient.clear(); | 524 m_newDisplayItemIndicesByClient.clear(); |
500 #endif | 525 #endif |
501 | 526 |
502 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 527 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
503 !m_newDisplayItemList.isEmpty()) | 528 !m_newDisplayItemList.isEmpty()) |
504 generateChunkRasterInvalidationRects(m_newPaintChunks.lastChunk()); | 529 generateChunkRasterInvalidationRects(m_newPaintChunks.lastChunk()); |
505 | 530 |
506 SkPictureGpuAnalyzer gpuAnalyzer; | 531 SkPictureGpuAnalyzer gpuAnalyzer; |
507 | 532 |
508 m_currentCacheGeneration = | 533 m_currentCacheGeneration = |
509 DisplayItemClient::CacheGenerationOrInvalidationReason::next(); | 534 DisplayItemClient::CacheGenerationOrInvalidationReason::next(); |
| 535 |
| 536 m_newCachedSubsequences.swap(m_currentCachedSubsequences); |
| 537 m_newCachedSubsequences.clear(); |
| 538 for (auto& item : m_currentCachedSubsequences) { |
| 539 item.key->setDisplayItemsCached(m_currentCacheGeneration); |
| 540 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 541 DisplayItemClient::endShouldKeepAliveAllClients(item.key); |
| 542 #endif |
| 543 } |
| 544 |
510 Vector<const DisplayItemClient*> skippedCacheClients; | 545 Vector<const DisplayItemClient*> skippedCacheClients; |
511 for (const auto& item : m_newDisplayItemList) { | 546 for (const auto& item : m_newDisplayItemList) { |
512 // No reason to continue the analysis once we have a veto. | 547 // No reason to continue the analysis once we have a veto. |
513 if (gpuAnalyzer.suitableForGpuRasterization()) | 548 if (gpuAnalyzer.suitableForGpuRasterization()) |
514 item.analyzeForGpuRasterization(gpuAnalyzer); | 549 item.analyzeForGpuRasterization(gpuAnalyzer); |
515 | 550 |
516 // TODO(wkorman): Only compute and append visual rect for drawings. | 551 // TODO(wkorman): Only compute and append visual rect for drawings. |
517 m_newDisplayItemList.appendVisualRect( | 552 m_newDisplayItemList.appendVisualRect( |
518 visualRectForDisplayItem(item, offsetFromLayoutObject)); | 553 visualRectForDisplayItem(item, offsetFromLayoutObject)); |
519 | 554 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 for (const auto& chunk : m_currentPaintArtifact.paintChunks()) { | 594 for (const auto& chunk : m_currentPaintArtifact.paintChunks()) { |
560 if (chunk.id && chunk.id->client.isJustCreated()) | 595 if (chunk.id && chunk.id->client.isJustCreated()) |
561 chunk.id->client.clearIsJustCreated(); | 596 chunk.id->client.clearIsJustCreated(); |
562 } | 597 } |
563 } | 598 } |
564 | 599 |
565 // We'll allocate the initial buffer when we start the next paint. | 600 // We'll allocate the initial buffer when we start the next paint. |
566 m_newDisplayItemList = DisplayItemList(0); | 601 m_newDisplayItemList = DisplayItemList(0); |
567 | 602 |
568 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 603 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
569 CHECK(m_currentSubsequenceClients.isEmpty()); | |
570 DisplayItemClient::endShouldKeepAliveAllClients(this); | 604 DisplayItemClient::endShouldKeepAliveAllClients(this); |
571 #endif | 605 #endif |
572 | 606 |
573 #ifndef NDEBUG | 607 #ifndef NDEBUG |
574 m_numSequentialMatches = 0; | 608 m_numSequentialMatches = 0; |
575 m_numOutOfOrderMatches = 0; | 609 m_numOutOfOrderMatches = 0; |
576 m_numIndexedItems = 0; | 610 m_numIndexedItems = 0; |
577 #endif | 611 #endif |
578 } | 612 } |
579 | 613 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 } | 812 } |
779 LOG(INFO) << "new record:\n" | 813 LOG(INFO) << "new record:\n" |
780 << (newRecord ? recordAsDebugString(newRecord) : "None"); | 814 << (newRecord ? recordAsDebugString(newRecord) : "None"); |
781 LOG(INFO) << "old record:\n" | 815 LOG(INFO) << "old record:\n" |
782 << (oldRecord ? recordAsDebugString(oldRecord) : "None"); | 816 << (oldRecord ? recordAsDebugString(oldRecord) : "None"); |
783 | 817 |
784 showDebugData(); | 818 showDebugData(); |
785 #endif // NDEBUG | 819 #endif // NDEBUG |
786 } | 820 } |
787 | 821 |
| 822 void PaintController::showSequenceUnderInvalidationError( |
| 823 const char* reason, |
| 824 const DisplayItemClient& client, |
| 825 int start, |
| 826 int end) { |
| 827 LOG(ERROR) << m_underInvalidationMessagePrefix << " " << reason; |
| 828 LOG(ERROR) << "Subsequence client: " << client.debugName(); |
| 829 #ifndef NDEBUG |
| 830 // showDebugData(); |
| 831 #else |
| 832 LOG(ERROR) << "Run debug build to get more details."; |
| 833 #endif |
| 834 LOG(ERROR) << "See http://crbug.com/619103."; |
| 835 } |
| 836 |
788 void PaintController::checkUnderInvalidation() { | 837 void PaintController::checkUnderInvalidation() { |
789 DCHECK(RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()); | 838 DCHECK(RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()); |
790 | 839 |
791 if (!isCheckingUnderInvalidation()) | 840 if (!isCheckingUnderInvalidation()) |
792 return; | 841 return; |
793 | 842 |
794 const DisplayItem& newItem = m_newDisplayItemList.last(); | 843 const DisplayItem& newItem = m_newDisplayItemList.last(); |
795 size_t oldItemIndex = m_underInvalidationCheckingBegin + | 844 size_t oldItemIndex = m_underInvalidationCheckingBegin + |
796 m_skippedProbableUnderInvalidationCount; | 845 m_skippedProbableUnderInvalidationCount; |
797 DisplayItem* oldItem = | 846 DisplayItem* oldItem = |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 showPaintRecords | 912 showPaintRecords |
864 ? (DisplayItemList::JsonOptions::ShowPaintRecords | | 913 ? (DisplayItemList::JsonOptions::ShowPaintRecords | |
865 DisplayItemList::JsonOptions::ShowClientDebugName) | 914 DisplayItemList::JsonOptions::ShowClientDebugName) |
866 : DisplayItemList::JsonOptions::ShowClientDebugName) | 915 : DisplayItemList::JsonOptions::ShowClientDebugName) |
867 ->toPrettyJSONString() | 916 ->toPrettyJSONString() |
868 .utf8() | 917 .utf8() |
869 .data()); | 918 .data()); |
870 } | 919 } |
871 | 920 |
872 } // namespace blink | 921 } // namespace blink |
OLD | NEW |