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

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

Issue 1327563003: Don't cache subsequence whose layer is not fully contained by repaint rect (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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
Index: Source/platform/graphics/paint/SubsequenceRecorder.cpp
diff --git a/Source/platform/graphics/paint/SubsequenceRecorder.cpp b/Source/platform/graphics/paint/SubsequenceRecorder.cpp
index 4f54dbff0cc2797c37d6c7e5174a82f4f75ef98c..4051b7ed41c4ccad06c06a07667bf6c30b52e4b8 100644
--- a/Source/platform/graphics/paint/SubsequenceRecorder.cpp
+++ b/Source/platform/graphics/paint/SubsequenceRecorder.cpp
@@ -33,11 +33,13 @@ bool SubsequenceRecorder::useCachedSubsequenceIfPossible(GraphicsContext& contex
SubsequenceRecorder::SubsequenceRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client)
: m_displayItemList(context.displayItemList())
, m_client(client)
+ , m_beginSubsequenceIndex(0)
{
if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
return;
ASSERT(m_displayItemList);
+ m_beginSubsequenceIndex = m_displayItemList->newDisplayItems().size();
m_displayItemList->createAndAppend<BeginSubsequenceDisplayItem>(m_client);
}
@@ -46,9 +48,26 @@ SubsequenceRecorder::~SubsequenceRecorder()
if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
return;
- // Don't remove no-op BeginSubsequence/EndSubsequence pairs because we need to
- // match them later with CachedSubsequences.
+ if (m_displayItemList->lastDisplayItemIsNoopBegin()) {
+ ASSERT(m_beginSubsequenceIndex == m_displayItemList->newDisplayItems().size() - 1);
+ // Remove uncacheable no-op BeginSubsequence/EndSubsequence pairs.
+ // Don't remove cacheable no-op pairs because we need to match them later with CachedSubsequences.
+ if (m_displayItemList->newDisplayItems().last().skippedCache()) {
+ m_displayItemList->removeLastDisplayItem();
+ return;
+ }
+ }
+
m_displayItemList->createAndAppend<EndSubsequenceDisplayItem>(m_client);
}
+void SubsequenceRecorder::setUncacheable()
+{
+ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+ return;
+
+ ASSERT(m_displayItemList->newDisplayItems()[m_beginSubsequenceIndex].type() == DisplayItem::BeginSubsequence);
+ m_displayItemList->newDisplayItems()[m_beginSubsequenceIndex].setSkippedCache();
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698