| 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 #include "platform/graphics/paint/DisplayItemClient.h" | 5 #include "platform/graphics/paint/DisplayItemClient.h" |
| 6 | 6 |
| 7 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 7 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 8 #include "wtf/HashMap.h" | 8 #include "wtf/HashMap.h" |
| 9 #include "wtf/HashSet.h" | 9 #include "wtf/HashSet.h" |
| 10 #endif | 10 #endif |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 DisplayItemClient::~DisplayItemClient() { | 34 DisplayItemClient::~DisplayItemClient() { |
| 35 if (displayItemClientsShouldKeepAlive) { | 35 if (displayItemClientsShouldKeepAlive) { |
| 36 for (auto& item : *displayItemClientsShouldKeepAlive) { | 36 for (auto& item : *displayItemClientsShouldKeepAlive) { |
| 37 CHECK(!item.value.contains(this)) | 37 CHECK(!item.value.contains(this)) |
| 38 << "Short-lived DisplayItemClient: " << item.value.get(this) | 38 << "Short-lived DisplayItemClient: " << item.value.get(this) |
| 39 << ". See crbug.com/609218."; | 39 << ". See crbug.com/609218."; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 liveDisplayItemClients->remove(this); | 42 liveDisplayItemClients->erase(this); |
| 43 // In case this object is a subsequence owner. | 43 // In case this object is a subsequence owner. |
| 44 endShouldKeepAliveAllClients(this); | 44 endShouldKeepAliveAllClients(this); |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool DisplayItemClient::isAlive() const { | 47 bool DisplayItemClient::isAlive() const { |
| 48 return liveDisplayItemClients && liveDisplayItemClients->contains(this); | 48 return liveDisplayItemClients && liveDisplayItemClients->contains(this); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void DisplayItemClient::beginShouldKeepAlive(const void* owner) const { | 51 void DisplayItemClient::beginShouldKeepAlive(const void* owner) const { |
| 52 CHECK(isAlive()); | 52 CHECK(isAlive()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 void DisplayItemClient::endShouldKeepAliveAllClients() { | 76 void DisplayItemClient::endShouldKeepAliveAllClients() { |
| 77 delete displayItemClientsShouldKeepAlive; | 77 delete displayItemClientsShouldKeepAlive; |
| 78 displayItemClientsShouldKeepAlive = nullptr; | 78 displayItemClientsShouldKeepAlive = nullptr; |
| 79 } | 79 } |
| 80 | 80 |
| 81 #endif // CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 81 #endif // CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 82 | 82 |
| 83 } // namespace blink | 83 } // namespace blink |
| OLD | NEW |