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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 void DisplayItemClient::beginShouldKeepAlive(const void* owner) const | 51 void DisplayItemClient::beginShouldKeepAlive(const void* owner) const |
52 { | 52 { |
53 CHECK(isAlive()); | 53 CHECK(isAlive()); |
54 if (!displayItemClientsShouldKeepAlive) | 54 if (!displayItemClientsShouldKeepAlive) |
55 displayItemClientsShouldKeepAlive = new HashMap<const void*, HashMap<con
st DisplayItemClient*, String>>(); | 55 displayItemClientsShouldKeepAlive = new HashMap<const void*, HashMap<con
st DisplayItemClient*, String>>(); |
56 auto addResult = displayItemClientsShouldKeepAlive->add(owner, HashMap<const
DisplayItemClient*, String>()).storedValue->value.add(this, ""); | 56 auto addResult = displayItemClientsShouldKeepAlive->add(owner, HashMap<const
DisplayItemClient*, String>()).storedValue->value.add(this, ""); |
57 if (addResult.isNewEntry) | 57 if (addResult.isNewEntry) |
58 addResult.storedValue->value = debugName(); | 58 addResult.storedValue->value = debugName(); |
59 } | 59 } |
60 | 60 |
| 61 void DisplayItemClient::endShouldKeepAlive() const |
| 62 { |
| 63 if (displayItemClientsShouldKeepAlive) { |
| 64 for (auto item : *displayItemClientsShouldKeepAlive) |
| 65 item.value.remove(this); |
| 66 } |
| 67 } |
| 68 |
61 void DisplayItemClient::endShouldKeepAliveAllClients(const void* owner) | 69 void DisplayItemClient::endShouldKeepAliveAllClients(const void* owner) |
62 { | 70 { |
63 if (displayItemClientsShouldKeepAlive) | 71 if (displayItemClientsShouldKeepAlive) |
64 displayItemClientsShouldKeepAlive->remove(owner); | 72 displayItemClientsShouldKeepAlive->remove(owner); |
65 } | 73 } |
66 | 74 |
67 void DisplayItemClient::endShouldKeepAliveAllClients() | 75 void DisplayItemClient::endShouldKeepAliveAllClients() |
68 { | 76 { |
69 delete displayItemClientsShouldKeepAlive; | 77 delete displayItemClientsShouldKeepAlive; |
70 displayItemClientsShouldKeepAlive = nullptr; | 78 displayItemClientsShouldKeepAlive = nullptr; |
71 } | 79 } |
72 | 80 |
73 #endif // CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 81 #endif // CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
74 | 82 |
75 } // namespace blink | 83 } // namespace blink |
OLD | NEW |