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

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

Issue 1508223005: Client side display item cache flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarTheme
Patch Set: Created 5 years 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/DisplayItemClient.h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h
index 118ac51dc755dbcb015e2d13318043ae8163f787..e8fc1a5652f3a021e4841088e3f678821deca5b7 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h
@@ -30,15 +30,37 @@ public:
// The visual rect of this DisplayItemClient, in the space of its containing GraphicsLayer.
virtual IntRect visualRect() const = 0;
+ static const unsigned kInvalidCacheGeneration = 0;
+
+ virtual bool displayItemsAreCached(unsigned cacheGeneration) const = 0;
+ virtual void setDisplayItemsCached(unsigned cacheGeneration) const = 0;
+
#if ENABLE(ASSERT)
// Tests if a DisplayItemClient object has been created and has not been deleted yet.
static bool isAlive(const DisplayItemClient&);
#endif
+
+protected:
+ // To make m_displayItemCacheGeneration (in DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION)
+ // automatically initialized.
+ struct DisplayItemCacheGeneration {
+ DisplayItemCacheGeneration() : value(kInvalidCacheGeneration) { }
+ unsigned value;
+ };
};
+#define DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION \
+ bool displayItemsAreCached(unsigned cacheGeneration) const final { return cacheGeneration != kInvalidCacheGeneration && m_displayItemCacheGeneration.value == cacheGeneration; } \
+ void setDisplayItemsCached(unsigned cacheGeneration) const final { m_displayItemCacheGeneration.value = cacheGeneration; } \
+ mutable DisplayItemCacheGeneration m_displayItemCacheGeneration;
+
+#define DISPLAY_ITEM_CACHE_STATUS_UNCACHEABLE_IMPLEMENTATION \
+ bool displayItemsAreCached(unsigned cacheGeneration) const final { return false; } \
+ void setDisplayItemsCached(unsigned cacheGeneration) const final { }
+
inline bool operator==(const DisplayItemClient& client1, const DisplayItemClient& client2) { return &client1 == &client2; }
inline bool operator!=(const DisplayItemClient& client1, const DisplayItemClient& client2) { return &client1 != &client2; }
-}
+} // namespace blink
#endif // DisplayItemClient_h

Powered by Google App Engine
This is Rietveld 408576698