Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp

Issue 2066603005: Check DisplayItemCient aliveness in cached subsequences (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/TraceEvent.h" 7 #include "platform/TraceEvent.h"
8 #include "platform/graphics/GraphicsLayer.h" 8 #include "platform/graphics/GraphicsLayer.h"
9 #include "platform/graphics/paint/DrawingDisplayItem.h" 9 #include "platform/graphics/paint/DrawingDisplayItem.h"
10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 59 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
60 m_newPaintChunks.decrementDisplayItemIndex(); 60 m_newPaintChunks.decrementDisplayItemIndex();
61 } 61 }
62 62
63 void PaintController::processNewItem(DisplayItem& displayItem) 63 void PaintController::processNewItem(DisplayItem& displayItem)
64 { 64 {
65 DCHECK(!m_constructionDisabled); 65 DCHECK(!m_constructionDisabled);
66 DCHECK(!skippingCache() || !displayItem.isCached()); 66 DCHECK(!skippingCache() || !displayItem.isCached());
67 67
68 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS 68 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS
69 if (!skippingCache() && (displayItem.isCacheable() || displayItem.isCached() )) 69 if (!skippingCache()) {
70 displayItem.client().beginShouldKeepAlive(this); 70 if (displayItem.isCacheable() || displayItem.isCached()) {
71 // Mark the client shouldKeepAlive under this PaintController.
72 // The status will end after the new display items are committed.
73 displayItem.client().beginShouldKeepAlive(this);
74
75 if (!m_currentSubsequenceClients.isEmpty()) {
76 // Mark the client shouldKeepAlive under the current subsequence .
77 // The status will end when the subsequence owner is invalidated or deleted.
78 displayItem.client().beginShouldKeepAlive(m_currentSubsequenceCl ients.last());
79 }
80 }
81
82 if (displayItem.getType() == DisplayItem::Subsequence) {
83 m_currentSubsequenceClients.append(&displayItem.client());
84 } else if (displayItem.getType() == DisplayItem::EndSubsequence) {
85 CHECK(m_currentSubsequenceClients.last() == &displayItem.client());
86 m_currentSubsequenceClients.removeLast();
87 }
88 }
71 #endif 89 #endif
72 90
73 if (displayItem.isCached()) 91 if (displayItem.isCached())
74 ++m_numCachedNewItems; 92 ++m_numCachedNewItems;
75 93
76 #if DCHECK_IS_ON() 94 #if DCHECK_IS_ON()
77 // Verify noop begin/end pairs have been removed. 95 // Verify noop begin/end pairs have been removed.
78 if (m_newDisplayItemList.size() >= 2 && displayItem.isEnd()) { 96 if (m_newDisplayItemList.size() >= 2 && displayItem.isEnd()) {
79 const auto& beginDisplayItem = m_newDisplayItemList[m_newDisplayItemList .size() - 2]; 97 const auto& beginDisplayItem = m_newDisplayItemList[m_newDisplayItemList .size() - 2];
80 if (beginDisplayItem.isBegin() && beginDisplayItem.getType() != DisplayI tem::Subsequence && !beginDisplayItem.drawsContent()) 98 if (beginDisplayItem.isBegin() && beginDisplayItem.getType() != DisplayI tem::Subsequence && !beginDisplayItem.drawsContent())
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 414
397 void PaintController::updateCacheGeneration() 415 void PaintController::updateCacheGeneration()
398 { 416 {
399 m_currentCacheGeneration = DisplayItemCacheGeneration::next(); 417 m_currentCacheGeneration = DisplayItemCacheGeneration::next();
400 for (const DisplayItem& displayItem : m_currentPaintArtifact.getDisplayItemL ist()) { 418 for (const DisplayItem& displayItem : m_currentPaintArtifact.getDisplayItemL ist()) {
401 if (!displayItem.isCacheable()) 419 if (!displayItem.isCacheable())
402 continue; 420 continue;
403 displayItem.client().setDisplayItemsCached(m_currentCacheGeneration); 421 displayItem.client().setDisplayItemsCached(m_currentCacheGeneration);
404 } 422 }
405 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS 423 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS
424 CHECK(m_currentSubsequenceClients.isEmpty());
406 DisplayItemClient::endShouldKeepAliveAllClients(this); 425 DisplayItemClient::endShouldKeepAliveAllClients(this);
407 #endif 426 #endif
408 } 427 }
409 428
410 void PaintController::appendDebugDrawingAfterCommit(const DisplayItemClient& dis playItemClient, PassRefPtr<SkPicture> picture, const LayoutSize& offsetFromLayou tObject) 429 void PaintController::appendDebugDrawingAfterCommit(const DisplayItemClient& dis playItemClient, PassRefPtr<SkPicture> picture, const LayoutSize& offsetFromLayou tObject)
411 { 430 {
412 DCHECK(m_newDisplayItemList.isEmpty()); 431 DCHECK(m_newDisplayItemList.isEmpty());
413 DrawingDisplayItem& displayItem = m_currentPaintArtifact.getDisplayItemList( ).allocateAndConstruct<DrawingDisplayItem>(displayItemClient, DisplayItem::Debug Drawing, picture); 432 DrawingDisplayItem& displayItem = m_currentPaintArtifact.getDisplayItemList( ).allocateAndConstruct<DrawingDisplayItem>(displayItemClient, DisplayItem::Debug Drawing, picture);
414 displayItem.setSkippedCache(); 433 displayItem.setSkippedCache();
415 m_currentPaintArtifact.getDisplayItemList().appendVisualRect(visualRectForDi splayItem(displayItem, offsetFromLayoutObject)); 434 m_currentPaintArtifact.getDisplayItemList().appendVisualRect(visualRectForDi splayItem(displayItem, offsetFromLayoutObject));
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 546
528 void PaintController::showDebugData() const 547 void PaintController::showDebugData() const
529 { 548 {
530 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); 549 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data());
531 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data()); 550 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data());
532 } 551 }
533 552
534 #endif // ifndef NDEBUG 553 #endif // ifndef NDEBUG
535 554
536 } // namespace blink 555 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698