Index: third_party/WebKit/Source/platform/graphics/paint/PaintController.h |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h |
index 29839e7f8447e0b9a45d50079979b13b113e42b5..c4c8801d440148d89c50c3f7375f0e92297f17f5 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h |
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h |
@@ -109,8 +109,11 @@ class PLATFORM_EXPORT PaintController { |
// true. Otherwise returns false. |
bool useCachedSubsequenceIfPossible(const DisplayItemClient&); |
+ void addCachedSubsequence(const DisplayItemClient&, |
+ unsigned start, |
+ unsigned end); |
+ |
// True if the last display item is a begin that doesn't draw content. |
- bool lastDisplayItemIsNoopBegin() const; |
void removeLastDisplayItem(); |
const DisplayItem* lastDisplayItem(unsigned offset); |
@@ -211,7 +214,9 @@ class PLATFORM_EXPORT PaintController { |
m_numOutOfOrderMatches(0), |
m_numIndexedItems(0) |
#endif |
- { |
+ , |
Xianzhu
2017/04/05 22:39:17
Nit: Move ',' before #endif and the ',' before #if
chrishtr
2017/04/06 00:05:29
Done.
|
+ m_underInvalidationCheckingBegin(0), |
+ m_underInvalidationCheckingEnd(0) { |
resetCurrentListIndices(); |
setTracksRasterInvalidations( |
RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()); |
@@ -221,6 +226,8 @@ class PLATFORM_EXPORT PaintController { |
friend class PaintControllerTestBase; |
friend class PaintControllerPaintTestBase; |
+ bool lastDisplayItemIsNoopBegin() const; |
+ |
void ensureNewDisplayItemListInitialCapacity() { |
if (m_newDisplayItemList.isEmpty()) { |
// TODO(wangxianzhu): Consider revisiting this heuristic. |
@@ -252,7 +259,7 @@ class PLATFORM_EXPORT PaintController { |
size_t findCachedItem(const DisplayItem::Id&); |
size_t findOutOfOrderCachedItemForward(const DisplayItem::Id&); |
- void copyCachedSubsequence(size_t&); |
+ void copyCachedSubsequence(size_t beginIndex, size_t endIndex); |
// Resets the indices (e.g. m_nextItemToMatch) of |
// m_currentPaintArtifact.getDisplayItemList() to their initial values. This |
@@ -273,12 +280,30 @@ class PLATFORM_EXPORT PaintController { |
void showUnderInvalidationError(const char* reason, |
const DisplayItem& newItem, |
const DisplayItem* oldItem) const; |
+ |
+ void showSequenceUnderInvalidationError(const char* reason, |
+ const DisplayItemClient&, |
+ int start, |
+ int end); |
+ |
void checkUnderInvalidation(); |
bool isCheckingUnderInvalidation() const { |
return m_underInvalidationCheckingEnd - m_underInvalidationCheckingBegin > |
0; |
} |
+ struct SubsequenceMarkers { |
+ SubsequenceMarkers() : start(0), end(0) {} |
+ SubsequenceMarkers(size_t startArg, size_t endArg) |
+ : start(startArg), end(endArg) {} |
+ // The start and end index within m_currentPaintArtifact of this |
+ // subsequence. |
+ size_t start; |
+ size_t end; |
+ }; |
+ |
+ SubsequenceMarkers* getSubsequenceMarkers(const DisplayItemClient&); |
+ |
// The last complete paint artifact. |
// In SPv2, this includes paint chunks as well as display items. |
PaintArtifact m_currentPaintArtifact; |
@@ -374,10 +399,13 @@ class PLATFORM_EXPORT PaintController { |
std::unique_ptr<RasterInvalidationTrackingMap<const PaintChunk>> |
m_paintChunksRasterInvalidationTrackingMap; |
-#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
- // A stack recording subsequence clients that are currently painting. |
- Vector<const DisplayItemClient*> m_currentSubsequenceClients; |
-#endif |
+ typedef HashMap<const DisplayItemClient*, SubsequenceMarkers> |
+ CachedSubsequenceMap; |
+ CachedSubsequenceMap m_currentCachedSubsequences; |
+ CachedSubsequenceMap m_newCachedSubsequences; |
+ |
+ FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedSubsequenceSwapOrder); |
+ FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedNestedSubsequenceUpdate); |
}; |
} // namespace blink |