Chromium Code Reviews| Index: public/platform/WebVector.h |
| diff --git a/public/platform/WebVector.h b/public/platform/WebVector.h |
| index e83a2d0d2cd56d627ae2b4d50fed0c0e3fcfa591..b22327bba676842cee2f6a7b08f71356936463d4 100644 |
| --- a/public/platform/WebVector.h |
| +++ b/public/platform/WebVector.h |
| @@ -152,6 +152,14 @@ public: |
| std::swap(m_size, other.m_size); |
| } |
| + void shrink(size_t size) |
|
tkent
2014/08/06 12:46:07
Why is this necessary?
WebVector has no rich opera
spartha
2014/08/06 13:31:09
The function pre-allocates the vector for efficien
|
| + { |
| + BLINK_ASSERT(size <= m_size); |
| + for (size_t index = m_size - 1; index >= size; --index) |
| + m_ptr[index].~T(); |
| + m_size = size; |
| + } |
| + |
| private: |
| void initialize(size_t size) |
| { |