| 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 #ifndef WeakIdentifierMap_h | 5 #ifndef WeakIdentifierMap_h |
| 6 #define WeakIdentifierMap_h | 6 #define WeakIdentifierMap_h |
| 7 | 7 |
| 8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 #include "wtf/Allocator.h" | 9 #include "platform/wtf/Allocator.h" |
| 10 #include "wtf/HashMap.h" | 10 #include "platform/wtf/HashMap.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 // TODO(sof): WeakIdentifierMap<> belongs (out) in wtf/, but | 14 // TODO(sof): WeakIdentifierMap<> belongs (out) in wtf/, but |
| 15 // cannot until GarbageCollected<> can be used from WTF. | 15 // cannot until GarbageCollected<> can be used from WTF. |
| 16 | 16 |
| 17 template <typename T, typename IdentifierType, bool isGarbageCollected> | 17 template <typename T, typename IdentifierType, bool isGarbageCollected> |
| 18 class WeakIdentifierMapBase { | 18 class WeakIdentifierMapBase { |
| 19 USING_FAST_MALLOC(WeakIdentifierMapBase); | 19 USING_FAST_MALLOC(WeakIdentifierMapBase); |
| 20 | 20 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 WeakIdentifierMap<T, ##__VA_ARGS__>::Instance() { \ | 103 WeakIdentifierMap<T, ##__VA_ARGS__>::Instance() { \ |
| 104 using RefType = WeakIdentifierMap<T, ##__VA_ARGS__>; \ | 104 using RefType = WeakIdentifierMap<T, ##__VA_ARGS__>; \ |
| 105 DEFINE_STATIC_LOCAL(RefType, map_instance, \ | 105 DEFINE_STATIC_LOCAL(RefType, map_instance, \ |
| 106 (new WeakIdentifierMap<T, ##__VA_ARGS__>())); \ | 106 (new WeakIdentifierMap<T, ##__VA_ARGS__>())); \ |
| 107 return map_instance; \ | 107 return map_instance; \ |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace blink | 110 } // namespace blink |
| 111 | 111 |
| 112 #endif // WeakIdentifierMap_h | 112 #endif // WeakIdentifierMap_h |
| OLD | NEW |