Chromium Code Reviews| Index: Source/platform/graphics/paint/DisplayItemList.cpp |
| diff --git a/Source/platform/graphics/paint/DisplayItemList.cpp b/Source/platform/graphics/paint/DisplayItemList.cpp |
| index bf6f39196b25898305e1bce36e72590a786d58a1..b32b4d3da7edc9e35fc2875fc12ccf8f2f585e54 100644 |
| --- a/Source/platform/graphics/paint/DisplayItemList.cpp |
| +++ b/Source/platform/graphics/paint/DisplayItemList.cpp |
| @@ -36,6 +36,7 @@ void DisplayItemList::add(WTF::PassOwnPtr<DisplayItem> displayItem) |
| { |
| ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
| ASSERT(!m_constructionDisabled); |
| + ASSERT(!skippingCache() || !displayItem->isCached()); |
| if (displayItem->isEnd()) { |
| ASSERT(!m_newDisplayItems.isEmpty()); |
| @@ -70,7 +71,10 @@ void DisplayItemList::add(WTF::PassOwnPtr<DisplayItem> displayItem) |
| ASSERT_NOT_REACHED(); |
| } |
| addItemToIndex(*displayItem, m_newDisplayItems.size(), m_newDisplayItemIndicesByClient); |
| -#endif |
| +#endif // ENABLE(ASSERT) |
| + |
|
chrishtr
2015/06/02 20:58:37
ASSERT(!displayItem.skippedCache()); // random co
Xianzhu
2015/06/02 21:10:32
Added the assert. It's reasonable to allow only Di
|
| + if (skippingCache()) |
| + displayItem->setSkippedCache(); |
| m_newDisplayItems.append(displayItem); |
| } |
| @@ -114,6 +118,8 @@ void DisplayItemList::invalidateAll() |
| bool DisplayItemList::clientCacheIsValid(DisplayItemClient client) const |
| { |
| + if (skippingCache()) |
| + return false; |
| updateValidlyCachedClientsIfNeeded(); |
| return m_validlyCachedClients.contains(client); |
| } |
| @@ -195,6 +201,7 @@ void DisplayItemList::commitNewDisplayItems() |
| m_clientScopeIdMap.clear(); |
| ASSERT(m_scopeStack.isEmpty()); |
| m_scopeStack.clear(); |
| + ASSERT(!skippingCache()); |
| #if ENABLE(ASSERT) |
| m_newDisplayItemIndicesByClient.clear(); |
| #endif |
| @@ -254,7 +261,7 @@ void DisplayItemList::commitNewDisplayItems() |
| if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) |
| checkCachedDisplayItemIsUnchanged(*newDisplayItem, displayItemIndicesByClient); |
| else |
| - ASSERT(!newDisplayItem->isDrawing() || !clientCacheIsValid(newDisplayItem->client())); |
| + ASSERT(!newDisplayItem->isDrawing() || newDisplayItem->skippedCache() || !clientCacheIsValid(newDisplayItem->client())); |
| #endif // ENABLE(ASSERT) |
| updatedList.append(newDisplayItem.release()); |
| } |
| @@ -287,7 +294,8 @@ void DisplayItemList::updateValidlyCachedClientsIfNeeded() const |
| if (displayItem->client() == lastClient) |
| continue; |
| lastClient = displayItem->client(); |
| - m_validlyCachedClients.add(lastClient); |
| + if (!displayItem->skippedCache()) |
| + m_validlyCachedClients.add(lastClient); |
| } |
| } |
| @@ -323,7 +331,11 @@ void DisplayItemList::checkCachedDisplayItemIsUnchanged(const DisplayItem& displ |
| if (!displayItem.isDrawing() || !clientCacheIsValid(displayItem.client())) |
| return; |
| - DrawingDisplayItem::UnderInvalidationCheckingMode mode = static_cast<const DrawingDisplayItem&>(displayItem).underInvalidationCheckingMode(); |
| + const DrawingDisplayItem& drawingDisplayItem = static_cast<const DrawingDisplayItem&>(displayItem); |
| + if (drawingDisplayItem.skippedCache()) |
| + return; |
| + |
| + DrawingDisplayItem::UnderInvalidationCheckingMode mode = drawingDisplayItem.underInvalidationCheckingMode(); |
| if (mode == DrawingDisplayItem::DontCheck) |
| return; |
| @@ -337,7 +349,7 @@ void DisplayItemList::checkCachedDisplayItemIsUnchanged(const DisplayItem& displ |
| return; |
| } |
| - RefPtr<const SkPicture> newPicture = static_cast<const DrawingDisplayItem&>(displayItem).picture(); |
| + RefPtr<const SkPicture> newPicture = drawingDisplayItem.picture(); |
| RefPtr<const SkPicture> oldPicture = static_cast<const DrawingDisplayItem&>(*m_currentDisplayItems[index]).picture(); |
| // Remove the display item from cache so that we can check if there are any remaining cached display items after merging. |
| m_currentDisplayItems[index] = nullptr; |