Chromium Code Reviews| 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..bcb76c89e1fbf09586086c8b3cf39f8958b12de3 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); |
| @@ -204,14 +207,14 @@ class PLATFORM_EXPORT PaintController { |
| m_imagePainted(false), |
| m_skippingCacheCount(0), |
| m_numCachedNewItems(0), |
| - m_currentCachedSubsequenceBeginIndexInNewList(kNotFound) |
| + m_currentCachedSubsequenceBeginIndexInNewList(kNotFound), |
| #ifndef NDEBUG |
| - , |
| m_numSequentialMatches(0), |
| m_numOutOfOrderMatches(0), |
| - m_numIndexedItems(0) |
| + m_numIndexedItems(0), |
| #endif |
| - { |
| + m_underInvalidationCheckingBegin(0), |
| + m_underInvalidationCheckingEnd(0) { |
| resetCurrentListIndices(); |
| setTracksRasterInvalidations( |
| RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()); |
| @@ -221,6 +224,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 +257,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 +278,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 +397,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 |
|
Xianzhu
2017/04/06 18:22:25
I think we should keep this which is useful for de
chrishtr
2017/04/06 20:01:14
Done.
|
| + 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 |