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/TraceEvent.h" | 9 #include "platform/TraceEvent.h" |
10 #include "platform/graphics/paint/DrawingDisplayItem.h" | 10 #include "platform/graphics/paint/DrawingDisplayItem.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 DisplayItemIndicesByClientMap::iterator it = m_newDisplayItemIndicesByClient
.find(m_newDisplayItems.last().client()); | 52 DisplayItemIndicesByClientMap::iterator it = m_newDisplayItemIndicesByClient
.find(m_newDisplayItems.last().client()); |
53 if (it != m_newDisplayItemIndicesByClient.end()) { | 53 if (it != m_newDisplayItemIndicesByClient.end()) { |
54 Vector<size_t>& indices = it->value; | 54 Vector<size_t>& indices = it->value; |
55 if (!indices.isEmpty() && indices.last() == (m_newDisplayItems.size() -
1)) | 55 if (!indices.isEmpty() && indices.last() == (m_newDisplayItems.size() -
1)) |
56 indices.removeLast(); | 56 indices.removeLast(); |
57 } | 57 } |
58 #endif | 58 #endif |
59 m_newDisplayItems.removeLast(); | 59 m_newDisplayItems.removeLast(); |
60 } | 60 } |
61 | 61 |
62 void DisplayItemList::processNewItem(DisplayItem* displayItem) | 62 void DisplayItemList::processNewItem(DisplayItem& displayItem) |
63 { | 63 { |
64 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 64 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
65 ASSERT(!m_constructionDisabled); | 65 ASSERT(!m_constructionDisabled); |
66 ASSERT(!skippingCache() || !displayItem->isCached()); | 66 ASSERT(!skippingCache() || !displayItem.isCached()); |
67 | 67 |
68 if (displayItem->isCached()) | 68 if (displayItem.isCached()) |
69 ++m_numCachedItems; | 69 ++m_numCachedItems; |
70 | 70 |
71 #if ENABLE(ASSERT) | 71 #if ENABLE(ASSERT) |
72 // Verify noop begin/end pairs have been removed. | 72 // Verify noop begin/end pairs have been removed. |
73 if (m_newDisplayItems.size() >= 2 && displayItem->isEnd()) { | 73 if (m_newDisplayItems.size() >= 2 && displayItem.isEnd()) { |
74 const auto& beginDisplayItem = m_newDisplayItems[m_newDisplayItems.size(
) - 2]; | 74 const auto& beginDisplayItem = m_newDisplayItems[m_newDisplayItems.size(
) - 2]; |
75 if (beginDisplayItem.isBegin() && beginDisplayItem.type() != DisplayItem
::BeginSubsequence && !beginDisplayItem.drawsContent()) | 75 if (beginDisplayItem.isBegin() && beginDisplayItem.type() != DisplayItem
::BeginSubsequence && !beginDisplayItem.drawsContent()) |
76 ASSERT(!displayItem->isEndAndPairedWith(beginDisplayItem.type())); | 76 ASSERT(!displayItem.isEndAndPairedWith(beginDisplayItem.type())); |
77 } | 77 } |
78 #endif | 78 #endif |
79 | 79 |
80 if (!m_scopeStack.isEmpty()) | 80 if (!m_scopeStack.isEmpty()) |
81 displayItem->setScope(m_scopeStack.last()); | 81 displayItem.setScope(m_scopeStack.last()); |
82 | 82 |
83 #if ENABLE(ASSERT) | 83 #if ENABLE(ASSERT) |
84 size_t index = findMatchingItemFromIndex(displayItem->nonCachedId(), m_newDi
splayItemIndicesByClient, m_newDisplayItems); | 84 size_t index = findMatchingItemFromIndex(displayItem.nonCachedId(), m_newDis
playItemIndicesByClient, m_newDisplayItems); |
85 if (index != kNotFound) { | 85 if (index != kNotFound) { |
86 #ifndef NDEBUG | 86 #ifndef NDEBUG |
87 showDebugData(); | 87 showDebugData(); |
88 WTFLogAlways("DisplayItem %s has duplicated id with previous %s (index=%
d)\n", | 88 WTFLogAlways("DisplayItem %s has duplicated id with previous %s (index=%
d)\n", |
89 displayItem->asDebugString().utf8().data(), m_newDisplayItems[index]
.asDebugString().utf8().data(), static_cast<int>(index)); | 89 displayItem.asDebugString().utf8().data(), m_newDisplayItems[index].
asDebugString().utf8().data(), static_cast<int>(index)); |
90 #endif | 90 #endif |
91 ASSERT_NOT_REACHED(); | 91 ASSERT_NOT_REACHED(); |
92 } | 92 } |
93 addItemToIndexIfNeeded(*displayItem, m_newDisplayItems.size() - 1, m_newDisp
layItemIndicesByClient); | 93 addItemToIndexIfNeeded(displayItem, m_newDisplayItems.size() - 1, m_newDispl
ayItemIndicesByClient); |
94 #endif // ENABLE(ASSERT) | 94 #endif // ENABLE(ASSERT) |
95 | 95 |
96 ASSERT(!displayItem->skippedCache()); // Only DisplayItemList can set the fl
ag. | 96 ASSERT(!displayItem.skippedCache()); // Only DisplayItemList can set the fla
g. |
97 if (skippingCache()) | 97 if (skippingCache()) |
98 displayItem->setSkippedCache(); | 98 displayItem.setSkippedCache(); |
99 } | 99 } |
100 | 100 |
101 void DisplayItemList::beginScope() | 101 void DisplayItemList::beginScope() |
102 { | 102 { |
103 ASSERT_WITH_SECURITY_IMPLICATION(m_nextScope < UINT_MAX); | 103 ASSERT_WITH_SECURITY_IMPLICATION(m_nextScope < UINT_MAX); |
104 m_scopeStack.append(m_nextScope++); | 104 m_scopeStack.append(m_nextScope++); |
105 beginSkippingCache(); | 105 beginSkippingCache(); |
106 } | 106 } |
107 | 107 |
108 void DisplayItemList::endScope() | 108 void DisplayItemList::endScope() |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 | 624 |
625 void DisplayItemList::replay(GraphicsContext& context) | 625 void DisplayItemList::replay(GraphicsContext& context) |
626 { | 626 { |
627 TRACE_EVENT0("blink,benchmark", "DisplayItemList::replay"); | 627 TRACE_EVENT0("blink,benchmark", "DisplayItemList::replay"); |
628 ASSERT(m_newDisplayItems.isEmpty()); | 628 ASSERT(m_newDisplayItems.isEmpty()); |
629 for (DisplayItem& displayItem : m_currentDisplayItems) | 629 for (DisplayItem& displayItem : m_currentDisplayItems) |
630 displayItem.replay(context); | 630 displayItem.replay(context); |
631 } | 631 } |
632 | 632 |
633 } // namespace blink | 633 } // namespace blink |
OLD | NEW |