Chromium Code Reviews| 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 668 template<typename U> bool contains(const U&) const; | 668 template<typename U> bool contains(const U&) const; |
| 669 template<typename U> size_t find(const U&) const; | 669 template<typename U> size_t find(const U&) const; |
| 670 template<typename U> size_t reverseFind(const U&) const; | 670 template<typename U> size_t reverseFind(const U&) const; |
| 671 | 671 |
| 672 void shrink(size_t size); | 672 void shrink(size_t size); |
| 673 void grow(size_t size); | 673 void grow(size_t size); |
| 674 void resize(size_t size); | 674 void resize(size_t size); |
| 675 void reserveCapacity(size_t newCapacity); | 675 void reserveCapacity(size_t newCapacity); |
| 676 void reserveInitialCapacity(size_t initialCapacity); | 676 void reserveInitialCapacity(size_t initialCapacity); |
| 677 void shrinkToFit() { shrinkCapacity(size()); } | 677 void shrinkToFit() { shrinkCapacity(size()); } |
| 678 void shrinkToReasonableCapacity() | |
| 679 { | |
| 680 if (size() * 2 < capacity()) | |
| 681 shrinkCapacity(size() + size() / 4 + 1); | |
|
abarth-chromium
2014/04/17 19:21:36
Is there a problem with integer overflow in this c
| |
| 682 } | |
| 678 | 683 |
| 679 void clear() { shrinkCapacity(0); } | 684 void clear() { shrinkCapacity(0); } |
| 680 | 685 |
| 681 template<typename U> void append(const U*, size_t); | 686 template<typename U> void append(const U*, size_t); |
| 682 template<typename U> void append(const U&); | 687 template<typename U> void append(const U&); |
| 683 template<typename U> void uncheckedAppend(const U& val); | 688 template<typename U> void uncheckedAppend(const U& val); |
| 684 template<typename U, size_t otherCapacity, typename V> void appendVector (const Vector<U, otherCapacity, V>&); | 689 template<typename U, size_t otherCapacity, typename V> void appendVector (const Vector<U, otherCapacity, V>&); |
| 685 | 690 |
| 686 template<typename U> void insert(size_t position, const U*, size_t); | 691 template<typename U> void insert(size_t position, const U*, size_t); |
| 687 template<typename U> void insert(size_t position, const U&); | 692 template<typename U> void insert(size_t position, const U&); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1201 } | 1206 } |
| 1202 if (this->hasOutOfLineBuffer()) | 1207 if (this->hasOutOfLineBuffer()) |
| 1203 Allocator::markNoTracing(visitor, buffer()); | 1208 Allocator::markNoTracing(visitor, buffer()); |
| 1204 } | 1209 } |
| 1205 | 1210 |
| 1206 } // namespace WTF | 1211 } // namespace WTF |
| 1207 | 1212 |
| 1208 using WTF::Vector; | 1213 using WTF::Vector; |
| 1209 | 1214 |
| 1210 #endif // WTF_Vector_h | 1215 #endif // WTF_Vector_h |
| OLD | NEW |