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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 VectorBuffer(size_t capacity) | 382 VectorBuffer(size_t capacity) |
383 : Base(inlineBuffer(), inlineCapacity) | 383 : Base(inlineBuffer(), inlineCapacity) |
384 { | 384 { |
385 if (capacity > inlineCapacity) | 385 if (capacity > inlineCapacity) |
386 Base::allocateBuffer(capacity); | 386 Base::allocateBuffer(capacity); |
387 } | 387 } |
388 | 388 |
389 ~VectorBuffer() | 389 ~VectorBuffer() |
390 { | 390 { |
391 deallocateBuffer(buffer()); | 391 deallocateBuffer(buffer()); |
| 392 m_buffer = 0; |
392 } | 393 } |
393 | 394 |
394 void allocateBuffer(size_t newCapacity) | 395 void allocateBuffer(size_t newCapacity) |
395 { | 396 { |
396 // FIXME: This should ASSERT(!m_buffer) to catch misuse/leaks. | 397 // FIXME: This should ASSERT(!m_buffer) to catch misuse/leaks. |
397 if (newCapacity > inlineCapacity) | 398 if (newCapacity > inlineCapacity) |
398 Base::allocateBuffer(newCapacity); | 399 Base::allocateBuffer(newCapacity); |
399 else { | 400 else { |
400 m_buffer = inlineBuffer(); | 401 m_buffer = inlineBuffer(); |
401 m_capacity = inlineCapacity; | 402 m_capacity = inlineCapacity; |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 inline bool operator!=(const Vector<T, inlineCapacity>& a, const Vector<T, i
nlineCapacity>& b) | 1064 inline bool operator!=(const Vector<T, inlineCapacity>& a, const Vector<T, i
nlineCapacity>& b) |
1064 { | 1065 { |
1065 return !(a == b); | 1066 return !(a == b); |
1066 } | 1067 } |
1067 | 1068 |
1068 } // namespace WTF | 1069 } // namespace WTF |
1069 | 1070 |
1070 using WTF::Vector; | 1071 using WTF::Vector; |
1071 | 1072 |
1072 #endif // WTF_Vector_h | 1073 #endif // WTF_Vector_h |
OLD | NEW |