OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DisplayItemClient_h | 5 #ifndef DisplayItemClient_h |
6 #define DisplayItemClient_h | 6 #define DisplayItemClient_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/geometry/LayoutRect.h" | 9 #include "platform/geometry/LayoutRect.h" |
10 #include "wtf/text/WTFString.h" | 10 #include "wtf/text/WTFString.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 #else | 24 #else |
25 virtual ~DisplayItemClient() { } | 25 virtual ~DisplayItemClient() { } |
26 #endif | 26 #endif |
27 | 27 |
28 virtual String debugName() const = 0; | 28 virtual String debugName() const = 0; |
29 | 29 |
30 // The visual rect of this DisplayItemClient, in object space of the object that owns the GraphicsLayer, i.e. | 30 // The visual rect of this DisplayItemClient, in object space of the object that owns the GraphicsLayer, i.e. |
31 // offset by offsetFromLayoutObjectWithSubpixelAccumulation(). | 31 // offset by offsetFromLayoutObjectWithSubpixelAccumulation(). |
32 virtual LayoutRect visualRect() const = 0; | 32 virtual LayoutRect visualRect() const = 0; |
33 | 33 |
34 static const unsigned kInvalidCacheGeneration = 0; | |
35 | |
36 virtual bool displayItemsAreCached(unsigned cacheGeneration) const = 0; | |
37 virtual void setDisplayItemsCached(unsigned cacheGeneration) const = 0; | |
38 | |
34 #if ENABLE(ASSERT) | 39 #if ENABLE(ASSERT) |
35 // Tests if a DisplayItemClient object has been created and has not been del eted yet. | 40 // Tests if a DisplayItemClient object has been created and has not been del eted yet. |
36 static bool isAlive(const DisplayItemClient&); | 41 static bool isAlive(const DisplayItemClient&); |
37 #endif | 42 #endif |
43 | |
44 static bool s_cacheStatus; | |
45 | |
46 protected: | |
47 // To make m_displayItemCacheGeneration (in DISPLAY_ITEM_CACHE_STATUS_IMPLEM ENTATION) | |
48 // automatically initialized. | |
49 struct DisplayItemCacheGeneration { | |
50 DisplayItemCacheGeneration() : value(kInvalidCacheGeneration) { } | |
51 unsigned value; | |
52 }; | |
38 }; | 53 }; |
39 | 54 |
55 #if 0 | |
chrishtr
2016/04/28 00:53:36
#if 0?
| |
56 #define DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION \ | |
57 bool displayItemsAreCached(unsigned cacheGeneration) const final { return ca cheGeneration != kInvalidCacheGeneration && m_displayItemCacheGeneration.value = = cacheGeneration; } \ | |
58 void setDisplayItemsCached(unsigned cacheGeneration) const final { m_display ItemCacheGeneration.value = cacheGeneration; } \ | |
59 mutable DisplayItemCacheGeneration m_displayItemCacheGeneration; | |
60 | |
61 #define DISPLAY_ITEM_CACHE_STATUS_UNCACHEABLE_IMPLEMENTATION #define DISPLAY_ITE M_CACHE_STATUS_IMPLEMENTATION \ | |
62 bool displayItemsAreCached(unsigned cacheGeneration) const final { return fa lse; } \ | |
63 void setDisplayItemsCached(unsigned cacheGeneration) const final { } | |
64 #endif | |
65 | |
66 #define DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION \ | |
67 bool displayItemsAreCached(unsigned cacheGeneration) const final { return s_ cacheStatus; } \ | |
68 void setDisplayItemsCached(unsigned cacheGeneration) const final { } | |
69 | |
70 #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?
| |
71 | |
40 inline bool operator==(const DisplayItemClient& client1, const DisplayItemClient & client2) { return &client1 == &client2; } | 72 inline bool operator==(const DisplayItemClient& client1, const DisplayItemClient & client2) { return &client1 == &client2; } |
41 inline bool operator!=(const DisplayItemClient& client1, const DisplayItemClient & client2) { return &client1 != &client2; } | 73 inline bool operator!=(const DisplayItemClient& client1, const DisplayItemClient & client2) { return &client1 != &client2; } |
42 | 74 |
43 } // namespace blink | 75 } // namespace blink |
44 | 76 |
45 #endif // DisplayItemClient_h | 77 #endif // DisplayItemClient_h |
OLD | NEW |