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

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

Issue 2457163002: WTF/std normalization: replace WTF::Vector::emplaceAppend with ::emplace_back (Closed)
Patch Set: rebase Created 4 years, 1 month 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
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 shrinkCapacity(size() + size() / 4 + 1); 939 shrinkCapacity(size() + size() / 4 + 1);
940 } 940 }
941 941
942 void clear() { shrinkCapacity(0); } 942 void clear() { shrinkCapacity(0); }
943 943
944 template <typename U> 944 template <typename U>
945 void append(const U*, size_t); 945 void append(const U*, size_t);
946 template <typename U> 946 template <typename U>
947 void append(U&&); 947 void append(U&&);
948 template <typename... Args> 948 template <typename... Args>
949 void emplaceAppend(Args&&...); 949 void emplace_back(Args&&...);
950 template <typename U> 950 template <typename U>
951 void uncheckedAppend(U&& val); 951 void uncheckedAppend(U&& val);
952 template <typename U, size_t otherCapacity, typename V> 952 template <typename U, size_t otherCapacity, typename V>
953 void appendVector(const Vector<U, otherCapacity, V>&); 953 void appendVector(const Vector<U, otherCapacity, V>&);
954 954
955 template <typename U> 955 template <typename U>
956 void insert(size_t position, const U*, size_t); 956 void insert(size_t position, const U*, size_t);
957 template <typename U> 957 template <typename U>
958 void insert(size_t position, U&&); 958 void insert(size_t position, U&&);
959 template <typename U, size_t c, typename V> 959 template <typename U, size_t c, typename V>
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 new (NotNull, end()) T(std::forward<U>(val)); 1389 new (NotNull, end()) T(std::forward<U>(val));
1390 ++m_size; 1390 ++m_size;
1391 return; 1391 return;
1392 } 1392 }
1393 1393
1394 appendSlowCase(std::forward<U>(val)); 1394 appendSlowCase(std::forward<U>(val));
1395 } 1395 }
1396 1396
1397 template <typename T, size_t inlineCapacity, typename Allocator> 1397 template <typename T, size_t inlineCapacity, typename Allocator>
1398 template <typename... Args> 1398 template <typename... Args>
1399 ALWAYS_INLINE void Vector<T, inlineCapacity, Allocator>::emplaceAppend( 1399 ALWAYS_INLINE void Vector<T, inlineCapacity, Allocator>::emplace_back(
esprehn 2016/11/04 23:49:34 std emplace_back returns a reference, should this
1400 Args&&... args) { 1400 Args&&... args) {
1401 static_assert(sizeof...(Args), "grow() must be called instead"); 1401 static_assert(sizeof...(Args), "grow() must be called instead");
1402 static_assert(sizeof...(Args) != 1, "append() must be called instead"); 1402 static_assert(sizeof...(Args) != 1, "append() must be called instead");
1403 1403
1404 DCHECK(Allocator::isAllocationAllowed()); 1404 DCHECK(Allocator::isAllocationAllowed());
1405 if (UNLIKELY(size() == capacity())) 1405 if (UNLIKELY(size() == capacity()))
1406 expandCapacity(size() + 1); 1406 expandCapacity(size() + 1);
1407 1407
1408 ANNOTATE_CHANGE_SIZE(begin(), capacity(), m_size, m_size + 1); 1408 ANNOTATE_CHANGE_SIZE(begin(), capacity(), m_size, m_size + 1);
1409 new (NotNull, end()) T(std::forward<Args>(args)...); 1409 new (NotNull, end()) T(std::forward<Args>(args)...);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 visitor, *const_cast<T*>(bufferEntry)); 1604 visitor, *const_cast<T*>(bufferEntry));
1605 checkUnusedSlots(buffer() + size(), buffer() + capacity()); 1605 checkUnusedSlots(buffer() + size(), buffer() + capacity());
1606 } 1606 }
1607 } 1607 }
1608 1608
1609 } // namespace WTF 1609 } // namespace WTF
1610 1610
1611 using WTF::Vector; 1611 using WTF::Vector;
1612 1612
1613 #endif // WTF_Vector_h 1613 #endif // WTF_Vector_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698