| 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 26 matching lines...) Expand all Loading... |
| 37 bool DisplayItemClient::isAlive() const | 37 bool DisplayItemClient::isAlive() const |
| 38 { | 38 { |
| 39 return liveDisplayItemClients && liveDisplayItemClients->contains(this); | 39 return liveDisplayItemClients && liveDisplayItemClients->contains(this); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void DisplayItemClient::beginShouldKeepAlive() const | 42 void DisplayItemClient::beginShouldKeepAlive() const |
| 43 { | 43 { |
| 44 CHECK(isAlive()); | 44 CHECK(isAlive()); |
| 45 if (!displayItemClientsShouldKeepAlive) | 45 if (!displayItemClientsShouldKeepAlive) |
| 46 displayItemClientsShouldKeepAlive = new HashMap<const DisplayItemClient*
, String>(); | 46 displayItemClientsShouldKeepAlive = new HashMap<const DisplayItemClient*
, String>(); |
| 47 #ifdef NDEBUG |
| 48 displayItemClientsShouldKeepAlive->add(this, ""); |
| 49 #else |
| 47 auto addResult = displayItemClientsShouldKeepAlive->add(this, ""); | 50 auto addResult = displayItemClientsShouldKeepAlive->add(this, ""); |
| 48 #ifndef NDEBUG | |
| 49 if (addResult.isNewEntry) | 51 if (addResult.isNewEntry) |
| 50 addResult.storedValue->value = debugName(); | 52 addResult.storedValue->value = debugName(); |
| 51 #endif | 53 #endif |
| 52 } | 54 } |
| 53 | 55 |
| 54 void DisplayItemClient::endShouldKeepAlive() const | 56 void DisplayItemClient::endShouldKeepAlive() const |
| 55 { | 57 { |
| 56 CHECK(isAlive()); | 58 CHECK(isAlive()); |
| 57 displayItemClientsShouldKeepAlive->remove(this); | 59 displayItemClientsShouldKeepAlive->remove(this); |
| 58 } | 60 } |
| 59 | 61 |
| 60 #endif // CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 62 #endif // CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 61 | 63 |
| 62 } // namespace blink | 64 } // namespace blink |
| OLD | NEW |