Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: third_party/WebKit/Source/wtf/Vector.h

Issue 2518253002: Move Partition Allocator into Chromium base. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 * 18 *
19 */ 19 */
20 20
21 #ifndef WTF_Vector_h 21 #ifndef WTF_Vector_h
22 #define WTF_Vector_h 22 #define WTF_Vector_h
23 23
24 #include "base/allocator/partition_allocator/partition_allocator.h"
24 #include "wtf/Alignment.h" 25 #include "wtf/Alignment.h"
25 #include "wtf/ConditionalDestructor.h" 26 #include "wtf/ConditionalDestructor.h"
26 #include "wtf/ContainerAnnotations.h" 27 #include "wtf/ContainerAnnotations.h"
27 #include "wtf/Noncopyable.h" 28 #include "wtf/Noncopyable.h"
28 #include "wtf/NotFound.h" 29 #include "wtf/NotFound.h"
29 #include "wtf/StdLibExtras.h" 30 #include "wtf/StdLibExtras.h"
30 #include "wtf/VectorTraits.h" 31 #include "wtf/VectorTraits.h"
31 #include "wtf/allocator/PartitionAllocator.h"
32 #include <algorithm> 32 #include <algorithm>
33 #include <initializer_list> 33 #include <initializer_list>
34 #include <iterator> 34 #include <iterator>
35 #include <string.h> 35 #include <string.h>
36 #include <utility> 36 #include <utility>
37 37
38 // For ASAN builds, disable inline buffers completely as they cause various 38 // For ASAN builds, disable inline buffers completely as they cause various
39 // issues. 39 // issues.
40 #ifdef ANNOTATE_CONTIGUOUS_CONTAINER 40 #ifdef ANNOTATE_CONTIGUOUS_CONTAINER
41 #define INLINE_CAPACITY 0 41 #define INLINE_CAPACITY 0
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 }; 790 };
791 // Heap-allocated vectors with no inlineCapacity never need a destructor. 791 // Heap-allocated vectors with no inlineCapacity never need a destructor.
792 template <typename T, 792 template <typename T,
793 size_t inlineCapacity = 0, 793 size_t inlineCapacity = 0,
794 typename Allocator = PartitionAllocator> 794 typename Allocator = PartitionAllocator>
795 class Vector 795 class Vector
796 : private VectorBuffer<T, INLINE_CAPACITY, Allocator>, 796 : private VectorBuffer<T, INLINE_CAPACITY, Allocator>,
797 public ConditionalDestructor<Vector<T, INLINE_CAPACITY, Allocator>, 797 public ConditionalDestructor<Vector<T, INLINE_CAPACITY, Allocator>,
798 (INLINE_CAPACITY == 0) && 798 (INLINE_CAPACITY == 0) &&
799 Allocator::isGarbageCollected> { 799 Allocator::isGarbageCollected> {
800 WTF_USE_ALLOCATOR(Vector, Allocator); 800 USE_ALLOCATOR(Vector, Allocator);
801 using Base = VectorBuffer<T, INLINE_CAPACITY, Allocator>; 801 using Base = VectorBuffer<T, INLINE_CAPACITY, Allocator>;
802 using TypeOperations = VectorTypeOperations<T>; 802 using TypeOperations = VectorTypeOperations<T>;
803 using OffsetRange = typename Base::OffsetRange; 803 using OffsetRange = typename Base::OffsetRange;
804 804
805 public: 805 public:
806 typedef T ValueType; 806 typedef T ValueType;
807 typedef T value_type; 807 typedef T value_type;
808 808
809 typedef T* iterator; 809 typedef T* iterator;
810 typedef const T* const_iterator; 810 typedef const T* const_iterator;
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 visitor, *const_cast<T*>(bufferEntry)); 1605 visitor, *const_cast<T*>(bufferEntry));
1606 checkUnusedSlots(buffer() + size(), buffer() + capacity()); 1606 checkUnusedSlots(buffer() + size(), buffer() + capacity());
1607 } 1607 }
1608 } 1608 }
1609 1609
1610 } // namespace WTF 1610 } // namespace WTF
1611 1611
1612 using WTF::Vector; 1612 using WTF::Vector;
1613 1613
1614 #endif // WTF_Vector_h 1614 #endif // WTF_Vector_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698