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

Unified Diff: Source/wtf/Deque.h

Issue 720163002: Oilpan: Vector::reserveCapacity shouldn't reallocate backing storage always (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/DefaultAllocator.h ('k') | Source/wtf/Vector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/Deque.h
diff --git a/Source/wtf/Deque.h b/Source/wtf/Deque.h
index 9ecabeca7294d8c438ada6c838169dd3166befe8..32ac42f5b211ea53c251a40f1de5c7ff2f522139 100644
--- a/Source/wtf/Deque.h
+++ b/Source/wtf/Deque.h
@@ -330,7 +330,10 @@ namespace WTF {
{
size_t oldCapacity = m_buffer.capacity();
T* oldBuffer = m_buffer.buffer();
- m_buffer.allocateBuffer(std::max(static_cast<size_t>(16), oldCapacity + oldCapacity / 4 + 1));
+ size_t newCapacity = std::max(static_cast<size_t>(16), oldCapacity + oldCapacity / 4 + 1);
+ if (m_buffer.expandBuffer(newCapacity))
+ return;
+ m_buffer.allocateBuffer(newCapacity);
if (m_start <= m_end)
TypeOperations::move(oldBuffer + m_start, oldBuffer + m_end, m_buffer.buffer() + m_start);
else {
« no previous file with comments | « Source/wtf/DefaultAllocator.h ('k') | Source/wtf/Vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698