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 ALLOW_ONLY_INLINE_ALLOCATI
ON objects that have trace methods into an off-heap Vector"); | 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"); |
637 #endif | 637 #endif |
638 ANNOTATE_NEW_BUFFER(begin(), capacity(), 0); | 638 ANNOTATE_NEW_BUFFER(begin(), capacity(), 0); |
639 m_size = 0; | 639 m_size = 0; |
640 } | 640 } |
641 | 641 |
642 explicit Vector(size_t size) | 642 explicit Vector(size_t size) |
643 : Base(size) | 643 : Base(size) |
644 { | 644 { |
645 static_assert(!IsPolymorphic<T>::value || !VectorTraits<T>::canInitializ
eWithMemset, "Cannot initialize with memset if there is a vtable"); | 645 static_assert(!IsPolymorphic<T>::value || !VectorTraits<T>::canInitializ
eWithMemset, "Cannot initialize with memset if there is a vtable"); |
646 #if ENABLE(OILPAN) | 646 #if ENABLE(OILPAN) |
647 static_assert(Allocator::isGarbageCollected || !IsAllowOnlyInlineAllocat
ion<T>::value || !NeedsTracing<T>::value, "Cannot put ALLOW_ONLY_INLINE_ALLOCATI
ON objects that have trace methods into an off-heap Vector"); | 647 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"); |
648 #endif | 648 #endif |
649 ANNOTATE_NEW_BUFFER(begin(), capacity(), size); | 649 ANNOTATE_NEW_BUFFER(begin(), capacity(), size); |
650 m_size = size; | 650 m_size = size; |
651 TypeOperations::initialize(begin(), end()); | 651 TypeOperations::initialize(begin(), end()); |
652 } | 652 } |
653 | 653 |
654 // Off-GC-heap vectors: Destructor should be called. | 654 // Off-GC-heap vectors: Destructor should be called. |
655 // On-GC-heap vectors: Destructor should be called for inline buffers (if | 655 // On-GC-heap vectors: Destructor should be called for inline buffers (if |
656 // any) but destructor shouldn't be called for vector backing since it is | 656 // any) but destructor shouldn't be called for vector backing since it is |
657 // managed by the traced GC heap. | 657 // managed by the traced GC heap. |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 struct NeedsTracing<Vector<T, N>> { | 1343 struct NeedsTracing<Vector<T, N>> { |
1344 static const bool value = false; | 1344 static const bool value = false; |
1345 }; | 1345 }; |
1346 #endif | 1346 #endif |
1347 | 1347 |
1348 } // namespace WTF | 1348 } // namespace WTF |
1349 | 1349 |
1350 using WTF::Vector; | 1350 using WTF::Vector; |
1351 | 1351 |
1352 #endif // WTF_Vector_h | 1352 #endif // WTF_Vector_h |
OLD | NEW |