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 reserv
ed. |
3 * Copyright (C) 2008 David Levin <levin@chromium.org> | 3 * Copyright (C) 2008 David Levin <levin@chromium.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 ValueType* result; | 995 ValueType* result; |
996 // Assert that we will not use memset on things with a vtable entry. The | 996 // Assert that we will not use memset on things with a vtable entry. The |
997 // compiler will also check this on some platforms. We would like to check | 997 // compiler will also check this on some platforms. We would like to check |
998 // this on the whole value (key-value pair), but IsPolymorphic will return | 998 // this on the whole value (key-value pair), but IsPolymorphic will return |
999 // false for a pair of two types, even if one of the components is | 999 // false for a pair of two types, even if one of the components is |
1000 // polymorphic. | 1000 // polymorphic. |
1001 static_assert(!Traits::emptyValueIsZero || !IsPolymorphic<KeyType>::value, "
empty value cannot be zero for things with a vtable"); | 1001 static_assert(!Traits::emptyValueIsZero || !IsPolymorphic<KeyType>::value, "
empty value cannot be zero for things with a vtable"); |
1002 | 1002 |
1003 #if ENABLE(OILPAN) | 1003 #if ENABLE(OILPAN) |
1004 static_assert(Allocator::isGarbageCollected | 1004 static_assert(Allocator::isGarbageCollected |
1005 || ((!IsAllowOnlyInlineAllocation<KeyType>::value || !NeedsTracing<KeyTy
pe>::value) | 1005 || ((!AllowsOnlyPlacementNew<KeyType>::value || !NeedsTracing<KeyType>::
value) |
1006 && (!IsAllowOnlyInlineAllocation<ValueType>::value || !NeedsTracing<Valu
eType>::value)) | 1006 && (!AllowsOnlyPlacementNew<ValueType>::value || !NeedsTracing<ValueType
>::value)) |
1007 , "Cannot put DISALLOW_NEW_EXCEPT_PLACEMENT_NEW objects that have trace
methods into an off-heap HashTable"); | 1007 , "Cannot put DISALLOW_NEW_EXCEPT_PLACEMENT_NEW objects that have trace
methods into an off-heap HashTable"); |
1008 #endif | 1008 #endif |
1009 if (Traits::emptyValueIsZero) { | 1009 if (Traits::emptyValueIsZero) { |
1010 result = Allocator::template allocateZeroedHashTableBacking<ValueType, H
ashTable>(allocSize); | 1010 result = Allocator::template allocateZeroedHashTableBacking<ValueType, H
ashTable>(allocSize); |
1011 } else { | 1011 } else { |
1012 result = Allocator::template allocateHashTableBacking<ValueType, HashTab
le>(allocSize); | 1012 result = Allocator::template allocateHashTableBacking<ValueType, HashTab
le>(allocSize); |
1013 for (unsigned i = 0; i < size; i++) | 1013 for (unsigned i = 0; i < size; i++) |
1014 initializeBucket(result[i]); | 1014 initializeBucket(result[i]); |
1015 } | 1015 } |
1016 return result; | 1016 return result; |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 CollectionIterator end(toBeRemoved.end()); | 1489 CollectionIterator end(toBeRemoved.end()); |
1490 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) | 1490 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) |
1491 collection.remove(*it); | 1491 collection.remove(*it); |
1492 } | 1492 } |
1493 | 1493 |
1494 } // namespace WTF | 1494 } // namespace WTF |
1495 | 1495 |
1496 #include "wtf/HashIterators.h" | 1496 #include "wtf/HashIterators.h" |
1497 | 1497 |
1498 #endif // WTF_HashTable_h | 1498 #endif // WTF_HashTable_h |
OLD | NEW |