| 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/Assertions.h" | 10 #include "wtf/Assertions.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // no longer dereferenced unless we can make sure the client is still valid. | 57 // no longer dereferenced unless we can make sure the client is still valid. |
| 58 class PLATFORM_EXPORT DisplayItemClient { | 58 class PLATFORM_EXPORT DisplayItemClient { |
| 59 public: | 59 public: |
| 60 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 60 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 61 DisplayItemClient(); | 61 DisplayItemClient(); |
| 62 virtual ~DisplayItemClient(); | 62 virtual ~DisplayItemClient(); |
| 63 | 63 |
| 64 // Tests if this DisplayItemClient object has been created and has not been
deleted yet. | 64 // Tests if this DisplayItemClient object has been created and has not been
deleted yet. |
| 65 bool isAlive() const; | 65 bool isAlive() const; |
| 66 // Called when any DisplayItem of this DisplayItemClient is added into Paint
Controller | 66 // Called when any DisplayItem of this DisplayItemClient is added into Paint
Controller |
| 67 // using PaintController::createAndAppend(). | 67 // using PaintController::createAndAppend() or into a cached subsequence. |
| 68 void beginShouldKeepAlive(const void* paintController) const; | 68 void beginShouldKeepAlive(const void* owner) const; |
| 69 // Clears all should-keep-alive DisplayItemClients of a PaintController. Cal
led after | 69 // Clears all should-keep-alive DisplayItemClients of a PaintController. Cal
led after |
| 70 // PaintController commits new display items. | 70 // PaintController commits new display items or the subsequence owner is inv
alidated. |
| 71 static void endShouldKeepAliveAllClients(const void* paintController); | 71 static void endShouldKeepAliveAllClients(const void* owner); |
| 72 static void endShouldKeepAliveAllClients(); | 72 static void endShouldKeepAliveAllClients(); |
| 73 |
| 74 // Called to clear should-keep-alive of DisplayItemClients in a subsequence
if this |
| 75 // object is a subsequence. |
| 76 #define ON_DISPLAY_ITEM_CLIENT_INVALIDATION() endShouldKeepAliveAllClients(this) |
| 73 #else | 77 #else |
| 74 virtual ~DisplayItemClient() { } | 78 virtual ~DisplayItemClient() { } |
| 79 #define ON_DISPLAY_ITEM_CLIENT_INVALIDATION() |
| 75 #endif | 80 #endif |
| 76 | 81 |
| 77 virtual String debugName() const = 0; | 82 virtual String debugName() const = 0; |
| 78 | 83 |
| 79 // The visual rect of this DisplayItemClient, in object space of the object
that owns the GraphicsLayer, i.e. | 84 // The visual rect of this DisplayItemClient, in object space of the object
that owns the GraphicsLayer, i.e. |
| 80 // offset by offsetFromLayoutObjectWithSubpixelAccumulation(). | 85 // offset by offsetFromLayoutObjectWithSubpixelAccumulation(). |
| 81 virtual LayoutRect visualRect() const = 0; | 86 virtual LayoutRect visualRect() const = 0; |
| 82 | 87 |
| 83 virtual bool displayItemsAreCached(DisplayItemCacheGeneration) const = 0; | 88 virtual bool displayItemsAreCached(DisplayItemCacheGeneration) const = 0; |
| 84 virtual void setDisplayItemsCached(DisplayItemCacheGeneration) const = 0; | 89 virtual void setDisplayItemsCached(DisplayItemCacheGeneration) const = 0; |
| 85 virtual void setDisplayItemsUncached() const = 0; | 90 virtual void setDisplayItemsUncached() const = 0; |
| 86 }; | 91 }; |
| 87 | 92 |
| 88 #define DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION \ | 93 #define DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION \ |
| 89 bool displayItemsAreCached(DisplayItemCacheGeneration cacheGeneration) const
final { return m_cacheGeneration.matches(cacheGeneration); } \ | 94 bool displayItemsAreCached(DisplayItemCacheGeneration cacheGeneration) const
final { return m_cacheGeneration.matches(cacheGeneration); } \ |
| 90 void setDisplayItemsCached(DisplayItemCacheGeneration cacheGeneration) const
final { m_cacheGeneration = cacheGeneration; } \ | 95 void setDisplayItemsCached(DisplayItemCacheGeneration cacheGeneration) const
final { m_cacheGeneration = cacheGeneration; } \ |
| 91 void setDisplayItemsUncached() const final { m_cacheGeneration.invalidate();
} \ | 96 void setDisplayItemsUncached() const final \ |
| 97 { \ |
| 98 m_cacheGeneration.invalidate(); \ |
| 99 ON_DISPLAY_ITEM_CLIENT_INVALIDATION(); \ |
| 100 } \ |
| 92 mutable DisplayItemCacheGeneration m_cacheGeneration; | 101 mutable DisplayItemCacheGeneration m_cacheGeneration; |
| 93 | 102 |
| 94 #define DISPLAY_ITEM_CACHE_STATUS_UNCACHEABLE_IMPLEMENTATION \ | 103 #define DISPLAY_ITEM_CACHE_STATUS_UNCACHEABLE_IMPLEMENTATION \ |
| 95 bool displayItemsAreCached(DisplayItemCacheGeneration) const final { return
false; } \ | 104 bool displayItemsAreCached(DisplayItemCacheGeneration) const final { return
false; } \ |
| 96 void setDisplayItemsCached(DisplayItemCacheGeneration) const final { } \ | 105 void setDisplayItemsCached(DisplayItemCacheGeneration) const final { } \ |
| 97 void setDisplayItemsUncached() const final { } | 106 void setDisplayItemsUncached() const final { } |
| 98 | 107 |
| 99 inline bool operator==(const DisplayItemClient& client1, const DisplayItemClient
& client2) { return &client1 == &client2; } | 108 inline bool operator==(const DisplayItemClient& client1, const DisplayItemClient
& client2) { return &client1 == &client2; } |
| 100 inline bool operator!=(const DisplayItemClient& client1, const DisplayItemClient
& client2) { return &client1 != &client2; } | 109 inline bool operator!=(const DisplayItemClient& client1, const DisplayItemClient
& client2) { return &client1 != &client2; } |
| 101 | 110 |
| 102 } // namespace blink | 111 } // namespace blink |
| 103 | 112 |
| 104 #endif // DisplayItemClient_h | 113 #endif // DisplayItemClient_h |
| OLD | NEW |