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

Unified Diff: Source/platform/graphics/paint/DisplayItemList.cpp

Issue 1192613003: Harden DisplayItemList in release mode not to crash on cached display item failures. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/graphics/paint/DisplayItemList.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/paint/DisplayItemList.cpp
diff --git a/Source/platform/graphics/paint/DisplayItemList.cpp b/Source/platform/graphics/paint/DisplayItemList.cpp
index ecff614061bf8af43a29f071b3b0343024db4298..354cbd420df95030f3d66ca5f0a2cb82f78e05ac 100644
--- a/Source/platform/graphics/paint/DisplayItemList.cpp
+++ b/Source/platform/graphics/paint/DisplayItemList.cpp
@@ -156,7 +156,7 @@ void DisplayItemList::addItemToIndex(DisplayItemClient client, DisplayItem::Type
indices.append(index);
}
-DisplayItems::Iterator DisplayItemList::findOutOfOrderCachedItem(DisplayItems::Iterator& currentIt, const DisplayItem::Id& id, DisplayItem::Type matchingType, DisplayItemIndicesByClientMap& displayItemIndicesByClient)
+DisplayItems::Iterator DisplayItemList::findOutOfOrderCachedItem(DisplayItems::Iterator currentIt, const DisplayItem::Id& id, DisplayItem::Type matchingType, DisplayItemIndicesByClientMap& displayItemIndicesByClient)
{
ASSERT(DisplayItem::isCachedType(id.type));
ASSERT(clientCacheIsValid(id.client));
@@ -169,7 +169,7 @@ DisplayItems::Iterator DisplayItemList::findOutOfOrderCachedItem(DisplayItems::I
}
// Find forward for the item and index all skipped indexable items.
-DisplayItems::Iterator DisplayItemList::findOutOfOrderCachedItemForward(DisplayItems::Iterator& currentIt, const DisplayItem::Id& id, DisplayItem::Type matchingType, DisplayItemIndicesByClientMap& displayItemIndicesByClient)
+DisplayItems::Iterator DisplayItemList::findOutOfOrderCachedItemForward(DisplayItems::Iterator currentIt, const DisplayItem::Id& id, DisplayItem::Type matchingType, DisplayItemIndicesByClientMap& displayItemIndicesByClient)
{
DisplayItems::Iterator currentEnd = m_currentDisplayItems.end();
for (; currentIt != currentEnd; ++currentIt) {
@@ -269,11 +269,16 @@ void DisplayItemList::commitNewDisplayItems()
showDebugData();
WTFLogAlways("CachedDisplayItem %s not found in m_currentDisplayItems\n",
newDisplayItem.asDebugString().utf8().data());
+ ASSERT_NOT_REACHED();
}
#endif
- // TODO(chrishtr): downgrade to ASSERT as this goes to beta users, and replace with bailing out of the rest of the merge.
- // This assert hits if we couldn't find the cached display item in our cache, which should be impossible.
- RELEASE_ASSERT(foundIt != currentEnd);
+ // If foundIt == currentEnd, it means that we did not find the cached display item. This should be impossible, but may occur
+ // if there is a bug in the system, such as under-invalidation, incorrect cache checking or duplicate display ids. In this case,
+ // attempt to recover rather than crashing or bailing on display of the rest of the display list.
+ if (foundIt == currentEnd)
+ continue;
+
+ currentIt = foundIt;
updatedList.appendByMoving(foundIt);
}
« no previous file with comments | « Source/platform/graphics/paint/DisplayItemList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698