| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // After the document cycle, a pointer/reference to DisplayItemClient should be | 56 // After the document cycle, a pointer/reference to DisplayItemClient should be |
| 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 |
| 66 // Called when any DisplayItem of this DisplayItemClient is added into Paint
Controller | 67 // Called when any DisplayItem of this DisplayItemClient is added into Paint
Controller |
| 67 // using PaintController::createAndAppend() or into a cached subsequence. | 68 // using PaintController::createAndAppend() or into a cached subsequence. |
| 68 void beginShouldKeepAlive(const void* owner) const; | 69 void beginShouldKeepAlive(const void* owner) const; |
| 70 |
| 71 // Called when the DisplayItemClient is sure that it can safely die before i
ts owners |
| 72 // have chance to remove it from the aliveness control. |
| 73 void endShouldKeepAlive() const; |
| 74 |
| 69 // Clears all should-keep-alive DisplayItemClients of a PaintController. Cal
led after | 75 // Clears all should-keep-alive DisplayItemClients of a PaintController. Cal
led after |
| 70 // PaintController commits new display items or the subsequence owner is inv
alidated. | 76 // PaintController commits new display items or the subsequence owner is inv
alidated. |
| 71 static void endShouldKeepAliveAllClients(const void* owner); | 77 static void endShouldKeepAliveAllClients(const void* owner); |
| 72 static void endShouldKeepAliveAllClients(); | 78 static void endShouldKeepAliveAllClients(); |
| 73 | 79 |
| 74 // Called to clear should-keep-alive of DisplayItemClients in a subsequence
if this | 80 // Called to clear should-keep-alive of DisplayItemClients in a subsequence
if this |
| 75 // object is a subsequence. | 81 // object is a subsequence. |
| 76 #define ON_DISPLAY_ITEM_CLIENT_INVALIDATION() endShouldKeepAliveAllClients(this) | 82 #define ON_DISPLAY_ITEM_CLIENT_INVALIDATION() endShouldKeepAliveAllClients(this) |
| 77 #else | 83 #else |
| 78 virtual ~DisplayItemClient() { } | 84 virtual ~DisplayItemClient() { } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 104 bool displayItemsAreCached(DisplayItemCacheGeneration) const final { return
false; } \ | 110 bool displayItemsAreCached(DisplayItemCacheGeneration) const final { return
false; } \ |
| 105 void setDisplayItemsCached(DisplayItemCacheGeneration) const final { } \ | 111 void setDisplayItemsCached(DisplayItemCacheGeneration) const final { } \ |
| 106 void setDisplayItemsUncached() const final { } | 112 void setDisplayItemsUncached() const final { } |
| 107 | 113 |
| 108 inline bool operator==(const DisplayItemClient& client1, const DisplayItemClient
& client2) { return &client1 == &client2; } | 114 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; } | 115 inline bool operator!=(const DisplayItemClient& client1, const DisplayItemClient
& client2) { return &client1 != &client2; } |
| 110 | 116 |
| 111 } // namespace blink | 117 } // namespace blink |
| 112 | 118 |
| 113 #endif // DisplayItemClient_h | 119 #endif // DisplayItemClient_h |
| OLD | NEW |