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 |