OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 template <typename T, typename U, typename V, typename W> | 129 template <typename T, typename U, typename V, typename W> |
130 inline void HashCountedSet<T, U, V, W>::removeAll(iterator it) | 130 inline void HashCountedSet<T, U, V, W>::removeAll(iterator it) |
131 { | 131 { |
132 if (it == end()) | 132 if (it == end()) |
133 return; | 133 return; |
134 | 134 |
135 m_impl.remove(it); | 135 m_impl.remove(it); |
136 } | 136 } |
137 | 137 |
138 template <typename Value, typename HashFunctions, typename Traits, typename Allo
cator, size_t inlineCapacity, typename VectorAllocator> | 138 template <typename Value, typename HashFunctions, typename Traits, typename Allo
cator, typename VectorType> |
139 inline void copyToVector(const HashCountedSet<Value, HashFunctions, Traits, Allo
cator>& collection, Vector<Value, inlineCapacity, VectorAllocator>& vector) | 139 inline void copyToVector(const HashCountedSet<Value, HashFunctions, Traits, Allo
cator>& collection, VectorType& vector) |
140 { | 140 { |
141 typedef typename HashCountedSet<Value, HashFunctions, Traits, Allocator>::co
nst_iterator iterator; | |
142 | |
143 { | 141 { |
144 // Disallow GC across resize allocation, see crbug.com/568173 | 142 // Disallow GC across resize allocation, see crbug.com/568173 |
145 typename Vector<Value, inlineCapacity, VectorAllocator>::GCForbiddenScop
e scope; | 143 typename VectorType::GCForbiddenScope scope; |
146 vector.resize(collection.size()); | 144 vector.resize(collection.size()); |
147 } | 145 } |
148 | 146 |
149 iterator it = collection.begin(); | 147 auto it = collection.begin(); |
150 iterator end = collection.end(); | 148 auto end = collection.end(); |
151 for (unsigned i = 0; it != end; ++it, ++i) | 149 for (unsigned i = 0; it != end; ++it, ++i) |
152 vector[i] = (*it).key; | 150 vector[i] = (*it).key; |
153 } | 151 } |
154 | 152 |
155 } // namespace WTF | 153 } // namespace WTF |
156 | 154 |
157 using WTF::HashCountedSet; | 155 using WTF::HashCountedSet; |
158 | 156 |
159 #endif // WTF_HashCountedSet_h | 157 #endif // WTF_HashCountedSet_h |
OLD | NEW |