Index: third_party/WebKit/Source/wtf/Vector.h |
diff --git a/third_party/WebKit/Source/wtf/Vector.h b/third_party/WebKit/Source/wtf/Vector.h |
index 5b50284b29f3c98f244e66884144907583cd4659..5d98d9b8fa829218f512880c3c860137d5418a80 100644 |
--- a/third_party/WebKit/Source/wtf/Vector.h |
+++ b/third_party/WebKit/Source/wtf/Vector.h |
@@ -917,6 +917,7 @@ public: |
template <typename U> void append(const U*, size_t); |
template <typename U> void append(U&&); |
+ template <typename... Args> void emplaceAppend(Args&&...); |
template <typename U> void uncheckedAppend(U&& val); |
template <typename U, size_t otherCapacity, typename V> void appendVector(const Vector<U, otherCapacity, V>&); |
@@ -1367,6 +1368,23 @@ ALWAYS_INLINE void Vector<T, inlineCapacity, Allocator>::append(U&& val) |
appendSlowCase(std::forward<U>(val)); |
} |
+ |
+template <typename T, size_t inlineCapacity, typename Allocator> |
+template <typename... Args> |
+ALWAYS_INLINE void Vector<T, inlineCapacity, Allocator>::emplaceAppend(Args&&... args) |
+{ |
+ static_assert(sizeof...(Args), "grow() must be called instead"); |
+ static_assert(sizeof...(Args) != 1, "append() must be called instead"); |
+ |
+ DCHECK(Allocator::isAllocationAllowed()); |
+ if (UNLIKELY(size() == capacity())) |
+ expandCapacity(size() + 1); |
+ |
+ ANNOTATE_CHANGE_SIZE(begin(), capacity(), m_size, m_size + 1); |
+ new (NotNull, end()) T(std::forward<Args>(args)...); |
+ ++m_size; |
+} |
+ |
template <typename T, size_t inlineCapacity, typename Allocator> |
template <typename U> |
NEVER_INLINE void Vector<T, inlineCapacity, Allocator>::appendSlowCase(U&& val) |