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 ENABLE(ASSERT) | 7 #if ENABLE(ASSERT) |
| 8 |
8 #include "wtf/HashSet.h" | 9 #include "wtf/HashSet.h" |
9 #endif | |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 DisplayItemCacheGeneration::Generation DisplayItemCacheGeneration::s_nextGenerat
ion = 1; | |
14 | |
15 #if ENABLE(ASSERT) | |
16 | |
17 HashSet<const DisplayItemClient*>* liveDisplayItemClients = nullptr; | 13 HashSet<const DisplayItemClient*>* liveDisplayItemClients = nullptr; |
18 | 14 |
19 DisplayItemClient::DisplayItemClient() | 15 DisplayItemClient::DisplayItemClient() |
20 { | 16 { |
21 if (!liveDisplayItemClients) | 17 if (!liveDisplayItemClients) |
22 liveDisplayItemClients = new HashSet<const DisplayItemClient*>(); | 18 liveDisplayItemClients = new HashSet<const DisplayItemClient*>(); |
23 liveDisplayItemClients->add(this); | 19 liveDisplayItemClients->add(this); |
24 } | 20 } |
25 | 21 |
26 DisplayItemClient::~DisplayItemClient() | 22 DisplayItemClient::~DisplayItemClient() |
27 { | 23 { |
28 liveDisplayItemClients->remove(this); | 24 liveDisplayItemClients->remove(this); |
29 } | 25 } |
30 | 26 |
31 bool DisplayItemClient::isAlive(const DisplayItemClient& client) | 27 bool DisplayItemClient::isAlive(const DisplayItemClient& client) |
32 { | 28 { |
33 return liveDisplayItemClients && liveDisplayItemClients->contains(&client); | 29 return liveDisplayItemClients && liveDisplayItemClients->contains(&client); |
34 } | 30 } |
35 | 31 |
| 32 } // namespace blink |
| 33 |
36 #endif // ENABLE(ASSERT) | 34 #endif // ENABLE(ASSERT) |
37 | |
38 } // namespace blink | |
OLD | NEW |