| 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 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 liveDisplayItemClients->remove(this); | 41 liveDisplayItemClients->remove(this); |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool DisplayItemClient::isAlive() const | 44 bool DisplayItemClient::isAlive() const |
| 45 { | 45 { |
| 46 return liveDisplayItemClients && liveDisplayItemClients->contains(this); | 46 return liveDisplayItemClients && liveDisplayItemClients->contains(this); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void DisplayItemClient::beginShouldKeepAlive(const void* owner) const | 49 void DisplayItemClient::beginShouldKeepAlive(const void* paintController) const |
| 50 { | 50 { |
| 51 CHECK(isAlive()); | 51 CHECK(isAlive()); |
| 52 if (!displayItemClientsShouldKeepAlive) | 52 if (!displayItemClientsShouldKeepAlive) |
| 53 displayItemClientsShouldKeepAlive = new HashMap<const void*, HashMap<con
st DisplayItemClient*, String>>(); | 53 displayItemClientsShouldKeepAlive = new HashMap<const void*, HashMap<con
st DisplayItemClient*, String>>(); |
| 54 auto addResult = displayItemClientsShouldKeepAlive->add(owner, HashMap<const
DisplayItemClient*, String>()).storedValue->value.add(this, ""); | 54 auto addResult = displayItemClientsShouldKeepAlive->add(paintController, Has
hMap<const DisplayItemClient*, String>()).storedValue->value.add(this, ""); |
| 55 if (addResult.isNewEntry) | 55 if (addResult.isNewEntry) |
| 56 addResult.storedValue->value = debugName(); | 56 addResult.storedValue->value = debugName(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void DisplayItemClient::endShouldKeepAliveAllClients(const void* owner) | 59 void DisplayItemClient::endShouldKeepAliveAllClients(const void* paintController
) |
| 60 { | 60 { |
| 61 if (displayItemClientsShouldKeepAlive) | 61 if (displayItemClientsShouldKeepAlive) |
| 62 displayItemClientsShouldKeepAlive->remove(owner); | 62 displayItemClientsShouldKeepAlive->remove(paintController); |
| 63 } |
| 64 |
| 65 void DisplayItemClient::endShouldKeepAliveAllClients() |
| 66 { |
| 67 delete displayItemClientsShouldKeepAlive; |
| 68 displayItemClientsShouldKeepAlive = nullptr; |
| 63 } | 69 } |
| 64 | 70 |
| 65 #endif // CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 71 #endif // CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 66 | 72 |
| 67 } // namespace blink | 73 } // namespace blink |
| OLD | NEW |