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

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

Issue 23608009: NULL out the buffer in the Vector<T, inline> destructor. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698