OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights |
| 3 * reserved. |
3 * Copyright (C) 2008 David Levin <levin@chromium.org> | 4 * Copyright (C) 2008 David Levin <levin@chromium.org> |
4 * | 5 * |
5 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
9 * | 10 * |
10 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABIL
ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public L
icense for more details. | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library |
| 14 * General Public License for more details. |
12 * | 15 * |
13 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
14 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
15 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
16 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
17 * | 20 * |
18 */ | 21 */ |
19 | 22 |
20 #ifndef WTF_HashTable_h | 23 #ifndef WTF_HashTable_h |
21 #define WTF_HashTable_h | 24 #define WTF_HashTable_h |
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 typename Traits, | 1497 typename Traits, |
1495 typename KeyTraits, | 1498 typename KeyTraits, |
1496 typename Allocator> | 1499 typename Allocator> |
1497 Value* | 1500 Value* |
1498 HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>:: | 1501 HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>:: |
1499 allocateTable(unsigned size) { | 1502 allocateTable(unsigned size) { |
1500 size_t allocSize = size * sizeof(ValueType); | 1503 size_t allocSize = size * sizeof(ValueType); |
1501 ValueType* result; | 1504 ValueType* result; |
1502 // Assert that we will not use memset on things with a vtable entry. The | 1505 // Assert that we will not use memset on things with a vtable entry. The |
1503 // compiler will also check this on some platforms. We would like to check | 1506 // compiler will also check this on some platforms. We would like to check |
1504 // this on the whole value (key-value pair), but std::is_polymorphic will retu
rn | 1507 // this on the whole value (key-value pair), but std::is_polymorphic will |
1505 // false for a pair of two types, even if one of the components is | 1508 // return false for a pair of two types, even if one of the components is |
1506 // polymorphic. | 1509 // polymorphic. |
1507 static_assert( | 1510 static_assert( |
1508 !Traits::emptyValueIsZero || !std::is_polymorphic<KeyType>::value, | 1511 !Traits::emptyValueIsZero || !std::is_polymorphic<KeyType>::value, |
1509 "empty value cannot be zero for things with a vtable"); | 1512 "empty value cannot be zero for things with a vtable"); |
1510 static_assert(Allocator::isGarbageCollected || | 1513 static_assert(Allocator::isGarbageCollected || |
1511 ((!AllowsOnlyPlacementNew<KeyType>::value || | 1514 ((!AllowsOnlyPlacementNew<KeyType>::value || |
1512 !IsTraceable<KeyType>::value) && | 1515 !IsTraceable<KeyType>::value) && |
1513 (!AllowsOnlyPlacementNew<ValueType>::value || | 1516 (!AllowsOnlyPlacementNew<ValueType>::value || |
1514 !IsTraceable<ValueType>::value)), | 1517 !IsTraceable<ValueType>::value)), |
1515 "Cannot put DISALLOW_NEW_EXCEPT_PLACEMENT_NEW objects that " | 1518 "Cannot put DISALLOW_NEW_EXCEPT_PLACEMENT_NEW objects that " |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2225 CollectionIterator end(toBeRemoved.end()); | 2228 CollectionIterator end(toBeRemoved.end()); |
2226 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) | 2229 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) |
2227 collection.remove(*it); | 2230 collection.remove(*it); |
2228 } | 2231 } |
2229 | 2232 |
2230 } // namespace WTF | 2233 } // namespace WTF |
2231 | 2234 |
2232 #include "wtf/HashIterators.h" | 2235 #include "wtf/HashIterators.h" |
2233 | 2236 |
2234 #endif // WTF_HashTable_h | 2237 #endif // WTF_HashTable_h |
OLD | NEW |