OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 | 626 |
627 typedef T* iterator; | 627 typedef T* iterator; |
628 typedef const T* const_iterator; | 628 typedef const T* const_iterator; |
629 typedef std::reverse_iterator<iterator> reverse_iterator; | 629 typedef std::reverse_iterator<iterator> reverse_iterator; |
630 typedef std::reverse_iterator<const_iterator> const_reverse_iterator; | 630 typedef std::reverse_iterator<const_iterator> const_reverse_iterator; |
631 | 631 |
632 Vector() | 632 Vector() |
633 { | 633 { |
634 static_assert(!IsPolymorphic<T>::value || !VectorTraits<T>::canInitializ
eWithMemset, "Cannot initialize with memset if there is a vtable"); | 634 static_assert(!IsPolymorphic<T>::value || !VectorTraits<T>::canInitializ
eWithMemset, "Cannot initialize with memset if there is a vtable"); |
635 #if ENABLE(OILPAN) | 635 #if ENABLE(OILPAN) |
636 static_assert(Allocator::isGarbageCollected || !IsAllowOnlyInlineAllocat
ion<T>::value || !NeedsTracing<T>::value, "Cannot put DISALLOW_NEW_EXCEPT_PLACEM
ENT_NEW objects that have trace methods into an off-heap Vector"); | 636 static_assert(Allocator::isGarbageCollected || !AllowsOnlyPlacementNew<T
>::value || !NeedsTracing<T>::value, "Cannot put DISALLOW_NEW_EXCEPT_PLACEMENT_N
EW objects that have trace methods into an off-heap Vector"); |
637 #endif | 637 #endif |
638 static_assert(Allocator::isGarbageCollected || !IsPointerToGarbageCollec
tedType<T>::value, "Cannot put raw pointers to garbage-collected classes into an
off-heap Vector. Use HeapVector<Member<T>> instead."); | 638 static_assert(Allocator::isGarbageCollected || !IsPointerToGarbageCollec
tedType<T>::value, "Cannot put raw pointers to garbage-collected classes into an
off-heap Vector. Use HeapVector<Member<T>> instead."); |
639 | 639 |
640 ANNOTATE_NEW_BUFFER(begin(), capacity(), 0); | 640 ANNOTATE_NEW_BUFFER(begin(), capacity(), 0); |
641 m_size = 0; | 641 m_size = 0; |
642 } | 642 } |
643 | 643 |
644 explicit Vector(size_t size) | 644 explicit Vector(size_t size) |
645 : Base(size) | 645 : Base(size) |
646 { | 646 { |
647 static_assert(!IsPolymorphic<T>::value || !VectorTraits<T>::canInitializ
eWithMemset, "Cannot initialize with memset if there is a vtable"); | 647 static_assert(!IsPolymorphic<T>::value || !VectorTraits<T>::canInitializ
eWithMemset, "Cannot initialize with memset if there is a vtable"); |
648 #if ENABLE(OILPAN) | 648 #if ENABLE(OILPAN) |
649 static_assert(Allocator::isGarbageCollected || !IsAllowOnlyInlineAllocat
ion<T>::value || !NeedsTracing<T>::value, "Cannot put DISALLOW_NEW_EXCEPT_PLACEM
ENT_NEW objects that have trace methods into an off-heap Vector"); | 649 static_assert(Allocator::isGarbageCollected || !AllowsOnlyPlacementNew<T
>::value || !NeedsTracing<T>::value, "Cannot put DISALLOW_NEW_EXCEPT_PLACEMENT_N
EW objects that have trace methods into an off-heap Vector"); |
650 #endif | 650 #endif |
651 static_assert(Allocator::isGarbageCollected || !IsPointerToGarbageCollec
tedType<T>::value, "Cannot put raw pointers to garbage-collected classes into an
off-heap Vector. Use HeapVector<Member<T>> instead."); | 651 static_assert(Allocator::isGarbageCollected || !IsPointerToGarbageCollec
tedType<T>::value, "Cannot put raw pointers to garbage-collected classes into an
off-heap Vector. Use HeapVector<Member<T>> instead."); |
652 | 652 |
653 ANNOTATE_NEW_BUFFER(begin(), capacity(), size); | 653 ANNOTATE_NEW_BUFFER(begin(), capacity(), size); |
654 m_size = size; | 654 m_size = size; |
655 TypeOperations::initialize(begin(), end()); | 655 TypeOperations::initialize(begin(), end()); |
656 } | 656 } |
657 | 657 |
658 // Off-GC-heap vectors: Destructor should be called. | 658 // Off-GC-heap vectors: Destructor should be called. |
659 // On-GC-heap vectors: Destructor should be called for inline buffers (if | 659 // On-GC-heap vectors: Destructor should be called for inline buffers (if |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 struct NeedsTracing<Vector<T, N>> { | 1347 struct NeedsTracing<Vector<T, N>> { |
1348 static const bool value = false; | 1348 static const bool value = false; |
1349 }; | 1349 }; |
1350 #endif | 1350 #endif |
1351 | 1351 |
1352 } // namespace WTF | 1352 } // namespace WTF |
1353 | 1353 |
1354 using WTF::Vector; | 1354 using WTF::Vector; |
1355 | 1355 |
1356 #endif // WTF_Vector_h | 1356 #endif // WTF_Vector_h |
OLD | NEW |