Index: third_party/WebKit/Source/platform/graphics/paint/SubsequenceRecorder.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/SubsequenceRecorder.cpp b/third_party/WebKit/Source/platform/graphics/paint/SubsequenceRecorder.cpp |
index 0a67e06fc58ad81cbca90df64a1eadc9650d5c58..371baf0346f88df6057e1a46a2d4b6e420d023e0 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/SubsequenceRecorder.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/paint/SubsequenceRecorder.cpp |
@@ -7,6 +7,7 @@ |
#include "platform/RuntimeEnabledFeatures.h" |
#include "platform/graphics/GraphicsContext.h" |
#include "platform/graphics/paint/PaintController.h" |
+#include "platform/graphics/paint/SubsequenceDisplayItem.h" |
namespace blink { |
@@ -19,27 +20,26 @@ |
return; |
m_beginSubsequenceIndex = m_paintController.newDisplayItemList().size(); |
- |
-#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
- m_paintController.beginSubsequence(m_client); |
-#endif |
+ m_paintController.createAndAppend<BeginSubsequenceDisplayItem>(m_client); |
} |
SubsequenceRecorder::~SubsequenceRecorder() { |
-#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
- m_paintController.endSubsequence(); |
-#endif |
- |
if (m_paintController.displayItemConstructionIsDisabled()) |
return; |
- // Skip empty subsequences. |
- if (m_paintController.newDisplayItemList().size() == m_beginSubsequenceIndex) |
- return; |
+ if (m_paintController.lastDisplayItemIsNoopBegin()) { |
+ ASSERT(m_beginSubsequenceIndex == |
+ m_paintController.newDisplayItemList().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_paintController.newDisplayItemList().last().skippedCache()) { |
+ m_paintController.removeLastDisplayItem(); |
+ return; |
+ } |
+ } |
- m_paintController.addCachedSubsequence( |
- m_client, m_beginSubsequenceIndex, |
- m_paintController.newDisplayItemList().size() - 1); |
+ m_paintController.createAndAppend<EndSubsequenceDisplayItem>(m_client); |
} |
} // namespace blink |