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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/PaintController.h

Issue 2793233002: Remove begin/end subseq. display items, and store on PaintController instead. (Closed)
Patch Set: none Created 3 years, 8 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: 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..59b1b38822823385009b5be7d489585b8e587ef2 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,10 @@ class PLATFORM_EXPORT PaintController {
m_numOutOfOrderMatches(0),
m_numIndexedItems(0)
#endif
- {
+ ,
+ m_underInvalidationCheckingBegin(0),
+ m_underInvalidationCheckingEnd(0),
+ m_isCheckingSubsequenceUnderInvalidation(false) {
resetCurrentListIndices();
setTracksRasterInvalidations(
RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled());
@@ -221,6 +227,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 +260,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 +281,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;
@@ -364,6 +390,7 @@ class PLATFORM_EXPORT PaintController {
// check if the actual painting results are the same as the cached.
size_t m_underInvalidationCheckingBegin;
size_t m_underInvalidationCheckingEnd;
+ bool m_isCheckingSubsequenceUnderInvalidation;
// Number of probable under-invalidations that have been skipped temporarily
// because the mismatching display items may be removed in the future because
@@ -374,10 +401,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

Powered by Google App Engine
This is Rietveld 408576698