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

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

Issue 20076: WebKit merge 40500:40539 [WebKit side] (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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
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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 const T& first() const { return at(0); } 496 const T& first() const { return at(0); }
497 T& last() { return at(size() - 1); } 497 T& last() { return at(size() - 1); }
498 const T& last() const { return at(size() - 1); } 498 const T& last() const { return at(size() - 1); }
499 499
500 template<typename U> size_t find(const U&) const; 500 template<typename U> size_t find(const U&) const;
501 501
502 void shrink(size_t size); 502 void shrink(size_t size);
503 void grow(size_t size); 503 void grow(size_t size);
504 void resize(size_t size); 504 void resize(size_t size);
505 void reserveCapacity(size_t newCapacity); 505 void reserveCapacity(size_t newCapacity);
506 void reserveInitialCapacity(size_t initialCapacity);
506 void shrinkCapacity(size_t newCapacity); 507 void shrinkCapacity(size_t newCapacity);
507 void shrinkToFit() { shrinkCapacity(size()); } 508 void shrinkToFit() { shrinkCapacity(size()); }
508 509
509 void clear() { shrinkCapacity(0); } 510 void clear() { shrinkCapacity(0); }
510 511
511 template<typename U> void append(const U*, size_t); 512 template<typename U> void append(const U*, size_t);
512 template<typename U> void append(const U&); 513 template<typename U> void append(const U&);
513 template<typename U> void uncheckedAppend(const U& val); 514 template<typename U> void uncheckedAppend(const U& val);
514 template<size_t otherCapacity> void append(const Vector<T, otherCapacity >&); 515 template<size_t otherCapacity> void append(const Vector<T, otherCapacity >&);
515 516
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 return; 727 return;
727 T* oldBuffer = begin(); 728 T* oldBuffer = begin();
728 T* oldEnd = end(); 729 T* oldEnd = end();
729 m_buffer.allocateBuffer(newCapacity); 730 m_buffer.allocateBuffer(newCapacity);
730 if (begin()) 731 if (begin())
731 TypeOperations::move(oldBuffer, oldEnd, begin()); 732 TypeOperations::move(oldBuffer, oldEnd, begin());
732 m_buffer.deallocateBuffer(oldBuffer); 733 m_buffer.deallocateBuffer(oldBuffer);
733 } 734 }
734 735
735 template<typename T, size_t inlineCapacity> 736 template<typename T, size_t inlineCapacity>
737 inline void Vector<T, inlineCapacity>::reserveInitialCapacity(size_t initial Capacity)
738 {
739 ASSERT(!m_size);
740 ASSERT(capacity() == inlineCapacity);
741 if (initialCapacity > inlineCapacity)
742 m_buffer.allocateBuffer(initialCapacity);
743 }
744
745 template<typename T, size_t inlineCapacity>
736 void Vector<T, inlineCapacity>::shrinkCapacity(size_t newCapacity) 746 void Vector<T, inlineCapacity>::shrinkCapacity(size_t newCapacity)
737 { 747 {
738 if (newCapacity >= capacity()) 748 if (newCapacity >= capacity())
739 return; 749 return;
740 750
741 if (newCapacity < size()) 751 if (newCapacity < size())
742 shrink(newCapacity); 752 shrink(newCapacity);
743 753
744 T* oldBuffer = begin(); 754 T* oldBuffer = begin();
745 if (newCapacity > 0) { 755 if (newCapacity > 0) {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 { 951 {
942 return !(a == b); 952 return !(a == b);
943 } 953 }
944 954
945 955
946 } // namespace WTF 956 } // namespace WTF
947 957
948 using WTF::Vector; 958 using WTF::Vector;
949 959
950 #endif // WTF_Vector_h 960 #endif // WTF_Vector_h
OLDNEW
« no previous file with comments | « third_party/WebKit/JavaScriptCore/wrec/WRECGenerator.cpp ('k') | third_party/WebKit/WebCore/ChangeLog » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698