| OLD | NEW |
| 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 527 |
| 528 // This is only called if the allocator is a HeapAllocator. It is used when | 528 // This is only called if the allocator is a HeapAllocator. It is used when |
| 529 // visiting during a tracing GC. | 529 // visiting during a tracing GC. |
| 530 template<typename T, size_t inlineCapacity, typename Allocator> | 530 template<typename T, size_t inlineCapacity, typename Allocator> |
| 531 template<typename VisitorDispatcher> | 531 template<typename VisitorDispatcher> |
| 532 void Deque<T, inlineCapacity, Allocator>::trace(VisitorDispatcher visitor) | 532 void Deque<T, inlineCapacity, Allocator>::trace(VisitorDispatcher visitor) |
| 533 { | 533 { |
| 534 ASSERT(Allocator::isGarbageCollected); // Garbage collector must be enab
led. | 534 ASSERT(Allocator::isGarbageCollected); // Garbage collector must be enab
led. |
| 535 const T* bufferBegin = m_buffer.buffer(); | 535 const T* bufferBegin = m_buffer.buffer(); |
| 536 const T* end = bufferBegin + m_end; | 536 const T* end = bufferBegin + m_end; |
| 537 if (ShouldBeTraced<VectorTraits<T> >::value) { | 537 if (ShouldBeTraced<VectorTraits<T>>::value) { |
| 538 if (m_start <= m_end) { | 538 if (m_start <= m_end) { |
| 539 for (const T* bufferEntry = bufferBegin + m_start; bufferEntry !
= end; bufferEntry++) | 539 for (const T* bufferEntry = bufferBegin + m_start; bufferEntry !
= end; bufferEntry++) |
| 540 Allocator::template trace<VisitorDispatcher, T, VectorTraits
<T> >(visitor, *const_cast<T*>(bufferEntry)); | 540 Allocator::template trace<VisitorDispatcher, T, VectorTraits
<T>>(visitor, *const_cast<T*>(bufferEntry)); |
| 541 } else { | 541 } else { |
| 542 for (const T* bufferEntry = bufferBegin; bufferEntry != end; buf
ferEntry++) | 542 for (const T* bufferEntry = bufferBegin; bufferEntry != end; buf
ferEntry++) |
| 543 Allocator::template trace<VisitorDispatcher, T, VectorTraits
<T> >(visitor, *const_cast<T*>(bufferEntry)); | 543 Allocator::template trace<VisitorDispatcher, T, VectorTraits
<T>>(visitor, *const_cast<T*>(bufferEntry)); |
| 544 const T* bufferEnd = m_buffer.buffer() + m_buffer.capacity(); | 544 const T* bufferEnd = m_buffer.buffer() + m_buffer.capacity(); |
| 545 for (const T* bufferEntry = bufferBegin + m_start; bufferEntry !
= bufferEnd; bufferEntry++) | 545 for (const T* bufferEntry = bufferBegin + m_start; bufferEntry !
= bufferEnd; bufferEntry++) |
| 546 Allocator::template trace<VisitorDispatcher, T, VectorTraits
<T> >(visitor, *const_cast<T*>(bufferEntry)); | 546 Allocator::template trace<VisitorDispatcher, T, VectorTraits
<T>>(visitor, *const_cast<T*>(bufferEntry)); |
| 547 } | 547 } |
| 548 } | 548 } |
| 549 if (m_buffer.hasOutOfLineBuffer()) | 549 if (m_buffer.hasOutOfLineBuffer()) |
| 550 Allocator::markNoTracing(visitor, m_buffer.buffer()); | 550 Allocator::markNoTracing(visitor, m_buffer.buffer()); |
| 551 } | 551 } |
| 552 | 552 |
| 553 template<typename T, size_t inlineCapacity, typename Allocator> | 553 template<typename T, size_t inlineCapacity, typename Allocator> |
| 554 inline void swap(Deque<T, inlineCapacity, Allocator>& a, Deque<T, inlineCapa
city, Allocator>& b) | 554 inline void swap(Deque<T, inlineCapacity, Allocator>& a, Deque<T, inlineCapa
city, Allocator>& b) |
| 555 { | 555 { |
| 556 a.swap(b); | 556 a.swap(b); |
| 557 } | 557 } |
| 558 | 558 |
| 559 #if !ENABLE(OILPAN) | 559 #if !ENABLE(OILPAN) |
| 560 template<typename T, size_t N> | 560 template<typename T, size_t N> |
| 561 struct NeedsTracing<Deque<T, N> > { | 561 struct NeedsTracing<Deque<T, N>> { |
| 562 static const bool value = false; | 562 static const bool value = false; |
| 563 }; | 563 }; |
| 564 #endif | 564 #endif |
| 565 | 565 |
| 566 } // namespace WTF | 566 } // namespace WTF |
| 567 | 567 |
| 568 using WTF::Deque; | 568 using WTF::Deque; |
| 569 | 569 |
| 570 #endif // WTF_Deque_h | 570 #endif // WTF_Deque_h |
| OLD | NEW |