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/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 Loading... | |
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 displayItem.client().beginShouldKeepAlive(this); | |
72 if (!m_subsequenceClients.isEmpty()) | |
73 displayItem.client().beginShouldKeepAlive(m_subsequenceClients.l ast()); | |
chrishtr
2016/06/18 08:49:57
What does this do exactly? beginShouldKeepAlive fo
Xianzhu
2016/06/18 17:41:30
Yes, this is to mark the new display item shouldKe
| |
74 } | |
75 | |
76 if (displayItem.getType() == DisplayItem::Subsequence) { | |
77 m_subsequenceClients.append(&displayItem.client()); | |
78 } else if (displayItem.getType() == DisplayItem::EndSubsequence) { | |
79 CHECK(m_subsequenceClients.last() == &displayItem.client()); | |
80 m_subsequenceClients.removeLast(); | |
81 } | |
82 } | |
71 #endif | 83 #endif |
72 | 84 |
73 if (displayItem.isCached()) | 85 if (displayItem.isCached()) |
74 ++m_numCachedNewItems; | 86 ++m_numCachedNewItems; |
75 | 87 |
76 #if DCHECK_IS_ON() | 88 #if DCHECK_IS_ON() |
77 // Verify noop begin/end pairs have been removed. | 89 // Verify noop begin/end pairs have been removed. |
78 if (m_newDisplayItemList.size() >= 2 && displayItem.isEnd()) { | 90 if (m_newDisplayItemList.size() >= 2 && displayItem.isEnd()) { |
79 const auto& beginDisplayItem = m_newDisplayItemList[m_newDisplayItemList .size() - 2]; | 91 const auto& beginDisplayItem = m_newDisplayItemList[m_newDisplayItemList .size() - 2]; |
80 if (beginDisplayItem.isBegin() && beginDisplayItem.getType() != DisplayI tem::Subsequence && !beginDisplayItem.drawsContent()) | 92 if (beginDisplayItem.isBegin() && beginDisplayItem.getType() != DisplayI tem::Subsequence && !beginDisplayItem.drawsContent()) |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
396 | 408 |
397 void PaintController::updateCacheGeneration() | 409 void PaintController::updateCacheGeneration() |
398 { | 410 { |
399 m_currentCacheGeneration = DisplayItemCacheGeneration::next(); | 411 m_currentCacheGeneration = DisplayItemCacheGeneration::next(); |
400 for (const DisplayItem& displayItem : m_currentPaintArtifact.getDisplayItemL ist()) { | 412 for (const DisplayItem& displayItem : m_currentPaintArtifact.getDisplayItemL ist()) { |
401 if (!displayItem.isCacheable()) | 413 if (!displayItem.isCacheable()) |
402 continue; | 414 continue; |
403 displayItem.client().setDisplayItemsCached(m_currentCacheGeneration); | 415 displayItem.client().setDisplayItemsCached(m_currentCacheGeneration); |
404 } | 416 } |
405 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 417 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
418 CHECK(m_subsequenceClients.isEmpty()); | |
406 DisplayItemClient::endShouldKeepAliveAllClients(this); | 419 DisplayItemClient::endShouldKeepAliveAllClients(this); |
407 #endif | 420 #endif |
408 } | 421 } |
409 | 422 |
410 void PaintController::appendDebugDrawingAfterCommit(const DisplayItemClient& dis playItemClient, PassRefPtr<SkPicture> picture, const LayoutSize& offsetFromLayou tObject) | 423 void PaintController::appendDebugDrawingAfterCommit(const DisplayItemClient& dis playItemClient, PassRefPtr<SkPicture> picture, const LayoutSize& offsetFromLayou tObject) |
411 { | 424 { |
412 DCHECK(m_newDisplayItemList.isEmpty()); | 425 DCHECK(m_newDisplayItemList.isEmpty()); |
413 DrawingDisplayItem& displayItem = m_currentPaintArtifact.getDisplayItemList( ).allocateAndConstruct<DrawingDisplayItem>(displayItemClient, DisplayItem::Debug Drawing, picture); | 426 DrawingDisplayItem& displayItem = m_currentPaintArtifact.getDisplayItemList( ).allocateAndConstruct<DrawingDisplayItem>(displayItemClient, DisplayItem::Debug Drawing, picture); |
414 displayItem.setSkippedCache(); | 427 displayItem.setSkippedCache(); |
415 m_currentPaintArtifact.getDisplayItemList().appendVisualRect(visualRectForDi splayItem(displayItem, offsetFromLayoutObject)); | 428 m_currentPaintArtifact.getDisplayItemList().appendVisualRect(visualRectForDi splayItem(displayItem, offsetFromLayoutObject)); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
527 | 540 |
528 void PaintController::showDebugData() const | 541 void PaintController::showDebugData() const |
529 { | 542 { |
530 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); | 543 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()); | 544 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data()); |
532 } | 545 } |
533 | 546 |
534 #endif // ifndef NDEBUG | 547 #endif // ifndef NDEBUG |
535 | 548 |
536 } // namespace blink | 549 } // namespace blink |
OLD | NEW |