Index: third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
index f474b93a45cf01ec08a84531734f1bad0981aa85..1d8e59430e936ac72b4c6da089f9b55227d7aa7e 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
@@ -66,8 +66,26 @@ void PaintController::processNewItem(DisplayItem& displayItem) |
DCHECK(!skippingCache() || !displayItem.isCached()); |
#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
- if (!skippingCache() && (displayItem.isCacheable() || displayItem.isCached())) |
- displayItem.client().beginShouldKeepAlive(this); |
+ if (!skippingCache()) { |
+ if (displayItem.isCacheable() || displayItem.isCached()) { |
+ // Mark the client shouldKeepAlive under this PaintController. |
+ // The status will end after the new display items are committed. |
+ displayItem.client().beginShouldKeepAlive(this); |
+ |
+ if (!m_currentSubsequenceClients.isEmpty()) { |
+ // Mark the client shouldKeepAlive under the current subsequence. |
+ // The status will end when the subsequence owner is invalidated or deleted. |
+ displayItem.client().beginShouldKeepAlive(m_currentSubsequenceClients.last()); |
+ } |
+ } |
+ |
+ if (displayItem.getType() == DisplayItem::Subsequence) { |
+ m_currentSubsequenceClients.append(&displayItem.client()); |
+ } else if (displayItem.getType() == DisplayItem::EndSubsequence) { |
+ CHECK(m_currentSubsequenceClients.last() == &displayItem.client()); |
+ m_currentSubsequenceClients.removeLast(); |
+ } |
+ } |
#endif |
if (displayItem.isCached()) |
@@ -403,6 +421,7 @@ void PaintController::updateCacheGeneration() |
displayItem.client().setDisplayItemsCached(m_currentCacheGeneration); |
} |
#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
+ CHECK(m_currentSubsequenceClients.isEmpty()); |
DisplayItemClient::endShouldKeepAliveAllClients(this); |
#endif |
} |