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 784aa638560e0a48fbaf3b4cdf80129dc29ac672..f47ff74ebd42a5f6270eb7884ca03b7379518ee2 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h |
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h |
@@ -31,12 +31,44 @@ public: |
// offset by offsetFromLayoutObjectWithSubpixelAccumulation(). |
virtual LayoutRect 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 |
+ |
+ static bool s_cacheStatus; |
+ |
+protected: |
+ // To make m_displayItemCacheGeneration (in DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION) |
+ // automatically initialized. |
+ struct DisplayItemCacheGeneration { |
+ DisplayItemCacheGeneration() : value(kInvalidCacheGeneration) { } |
+ unsigned value; |
+ }; |
}; |
+#if 0 |
chrishtr
2016/04/28 00:53:36
#if 0?
|
+#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 #define DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION \ |
+ bool displayItemsAreCached(unsigned cacheGeneration) const final { return false; } \ |
+ void setDisplayItemsCached(unsigned cacheGeneration) const final { } |
+#endif |
+ |
+#define DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION \ |
+ bool displayItemsAreCached(unsigned cacheGeneration) const final { return s_cacheStatus; } \ |
+ void setDisplayItemsCached(unsigned cacheGeneration) const final { } |
+ |
+#define DISPLAY_ITEM_CACHE_STATUS_UNCACHEABLE_IMPLEMENTATION DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION |
chrishtr
2016/04/28 00:53:36
Uncached and cached are the same?
|
+ |
inline bool operator==(const DisplayItemClient& client1, const DisplayItemClient& client2) { return &client1 == &client2; } |
inline bool operator!=(const DisplayItemClient& client1, const DisplayItemClient& client2) { return &client1 != &client2; } |