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 f4723e3b27c2f291c80104e8df8da8ae8adc2f5c..32789455cd6c2b84e61ed00c9cbd691e054695a9 100644 |
| --- a/Source/platform/graphics/paint/DisplayItemList.cpp |
| +++ b/Source/platform/graphics/paint/DisplayItemList.cpp |
| @@ -15,11 +15,26 @@ |
| namespace blink { |
| -const PaintList& DisplayItemList::paintList() |
| +void DisplayItemList::beginNewPaints() |
| { |
| ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
| + ASSERT(!m_newPaints.size()); |
| + ASSERT(!m_doingNewPaints); |
| + m_doingNewPaints = true; |
| +} |
| +void DisplayItemList::endNewPaints() |
| +{ |
| + ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
| + ASSERT(m_doingNewPaints); |
| + m_doingNewPaints = false; |
| updatePaintList(); |
| +} |
| + |
| +const PaintList& DisplayItemList::paintList() |
| +{ |
| + ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
| + ASSERT(!m_doingNewPaints); |
| return m_paintList; |
| } |
| @@ -39,11 +54,16 @@ void DisplayItemList::invalidateAll() |
| { |
| ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
| // Can only be called during layout/paintInvalidation, not during painting. |
| - ASSERT(m_newPaints.isEmpty()); |
| + ASSERT(!m_doingNewPaints && m_newPaints.isEmpty()); |
|
chrishtr
2015/01/20 23:18:53
Looks like m_doingNewPaints is only used in ASSERT
Xianzhu
2015/01/20 23:48:11
It was to ensure beginNewPaints() and endNewPaints
|
| m_paintList.clear(); |
| m_cachedClients.clear(); |
| } |
| +bool DisplayItemList::clientCacheIsValid(DisplayItemClient client) const |
| +{ |
| + return RuntimeEnabledFeatures::slimmingPaintDisplayItemCacheEnabled() && m_cachedClients.contains(client); |
| +} |
| + |
| PaintList::iterator DisplayItemList::findNextMatchingCachedItem(PaintList::iterator begin, const DisplayItem& displayItem) |
| { |
| PaintList::iterator end = m_paintList.end(); |
| @@ -74,6 +94,13 @@ static void appendDisplayItem(PaintList& list, HashSet<DisplayItemClient>& clien |
| // the ordering implied by the existing paint list, extra treewalks are avoided. |
| void DisplayItemList::updatePaintList() |
| { |
| + if (!RuntimeEnabledFeatures::slimmingPaintDisplayItemCacheEnabled()) { |
| + m_paintList.clear(); |
| + m_paintList.swap(m_newPaints); |
| + m_cachedClients.clear(); |
| + return; |
| + } |
| + |
| PaintList updatedList; |
| HashSet<DisplayItemClient> newCachedClients; |