| 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 10 matching lines...) Expand all Loading... |
| 21 HashMap<const void*, HashMap<const DisplayItemClient*, String>>* | 21 HashMap<const void*, HashMap<const DisplayItemClient*, String>>* |
| 22 displayItemClientsShouldKeepAlive = nullptr; | 22 displayItemClientsShouldKeepAlive = nullptr; |
| 23 | 23 |
| 24 DisplayItemClient::DisplayItemClient() { | 24 DisplayItemClient::DisplayItemClient() { |
| 25 if (displayItemClientsShouldKeepAlive) { | 25 if (displayItemClientsShouldKeepAlive) { |
| 26 for (auto item : *displayItemClientsShouldKeepAlive) | 26 for (auto item : *displayItemClientsShouldKeepAlive) |
| 27 CHECK(!item.value.contains(this)); | 27 CHECK(!item.value.contains(this)); |
| 28 } | 28 } |
| 29 if (!liveDisplayItemClients) | 29 if (!liveDisplayItemClients) |
| 30 liveDisplayItemClients = new HashSet<const DisplayItemClient*>(); | 30 liveDisplayItemClients = new HashSet<const DisplayItemClient*>(); |
| 31 liveDisplayItemClients->add(this); | 31 liveDisplayItemClients->insert(this); |
| 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 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 void DisplayItemClient::endShouldKeepAliveAllClients() { | 75 void DisplayItemClient::endShouldKeepAliveAllClients() { |
| 76 delete displayItemClientsShouldKeepAlive; | 76 delete displayItemClientsShouldKeepAlive; |
| 77 displayItemClientsShouldKeepAlive = nullptr; | 77 displayItemClientsShouldKeepAlive = nullptr; |
| 78 } | 78 } |
| 79 | 79 |
| 80 #endif // CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 80 #endif // CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 81 | 81 |
| 82 } // namespace blink | 82 } // namespace blink |
| OLD | NEW |