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

Side by Side Diff: Source/wtf/Deque.h

Issue 1086413003: Oilpan: HeapVectorBacking should call destructors for its elements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased past r194046 (upto r194085.) Created 5 years, 8 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
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/wtf/Vector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 { 331 {
332 size_t oldCapacity = m_buffer.capacity(); 332 size_t oldCapacity = m_buffer.capacity();
333 T* oldBuffer = m_buffer.buffer(); 333 T* oldBuffer = m_buffer.buffer();
334 size_t newCapacity = std::max(static_cast<size_t>(16), oldCapacity + old Capacity / 4 + 1); 334 size_t newCapacity = std::max(static_cast<size_t>(16), oldCapacity + old Capacity / 4 + 1);
335 if (m_buffer.expandBuffer(newCapacity)) { 335 if (m_buffer.expandBuffer(newCapacity)) {
336 if (m_start <= m_end) { 336 if (m_start <= m_end) {
337 // No adjustments to be done. 337 // No adjustments to be done.
338 } else { 338 } else {
339 size_t newStart = m_buffer.capacity() - (oldCapacity - m_start); 339 size_t newStart = m_buffer.capacity() - (oldCapacity - m_start);
340 TypeOperations::moveOverlapping(oldBuffer + m_start, oldBuffer + oldCapacity, m_buffer.buffer() + newStart); 340 TypeOperations::moveOverlapping(oldBuffer + m_start, oldBuffer + oldCapacity, m_buffer.buffer() + newStart);
341 m_buffer.clearUnusedSlots(oldBuffer + m_start, oldBuffer + std:: min(oldCapacity, newStart));
341 m_start = newStart; 342 m_start = newStart;
342 } 343 }
343 return; 344 return;
344 } 345 }
345 m_buffer.allocateBuffer(newCapacity); 346 m_buffer.allocateBuffer(newCapacity);
346 if (m_start <= m_end) 347 if (m_start <= m_end) {
347 TypeOperations::move(oldBuffer + m_start, oldBuffer + m_end, m_buffe r.buffer() + m_start); 348 TypeOperations::move(oldBuffer + m_start, oldBuffer + m_end, m_buffe r.buffer() + m_start);
348 else { 349 m_buffer.clearUnusedSlots(oldBuffer + m_start, oldBuffer + m_end);
350 } else {
349 TypeOperations::move(oldBuffer, oldBuffer + m_end, m_buffer.buffer() ); 351 TypeOperations::move(oldBuffer, oldBuffer + m_end, m_buffer.buffer() );
352 m_buffer.clearUnusedSlots(oldBuffer, oldBuffer + m_end);
350 size_t newStart = m_buffer.capacity() - (oldCapacity - m_start); 353 size_t newStart = m_buffer.capacity() - (oldCapacity - m_start);
351 TypeOperations::move(oldBuffer + m_start, oldBuffer + oldCapacity, m _buffer.buffer() + newStart); 354 TypeOperations::move(oldBuffer + m_start, oldBuffer + oldCapacity, m _buffer.buffer() + newStart);
355 m_buffer.clearUnusedSlots(oldBuffer + m_start, oldBuffer + oldCapaci ty);
352 m_start = newStart; 356 m_start = newStart;
353 } 357 }
354 m_buffer.deallocateBuffer(oldBuffer); 358 m_buffer.deallocateBuffer(oldBuffer);
355 } 359 }
356 360
357 template<typename T, size_t inlineCapacity, typename Allocator> 361 template<typename T, size_t inlineCapacity, typename Allocator>
358 inline typename Deque<T, inlineCapacity, Allocator>::PassType Deque<T, inlin eCapacity, Allocator>::takeFirst() 362 inline typename Deque<T, inlineCapacity, Allocator>::PassType Deque<T, inlin eCapacity, Allocator>::takeFirst()
359 { 363 {
360 T oldFirst = Pass::transfer(first()); 364 T oldFirst = Pass::transfer(first());
361 removeFirst(); 365 removeFirst();
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 struct NeedsTracing<Deque<T, N>> { 566 struct NeedsTracing<Deque<T, N>> {
563 static const bool value = false; 567 static const bool value = false;
564 }; 568 };
565 #endif 569 #endif
566 570
567 } // namespace WTF 571 } // namespace WTF
568 572
569 using WTF::Deque; 573 using WTF::Deque;
570 574
571 #endif // WTF_Deque_h 575 #endif // WTF_Deque_h
OLDNEW
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/wtf/Vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698