Index: src/zone/zone-chunk-list.h |
diff --git a/src/zone/zone-chunk-list.h b/src/zone/zone-chunk-list.h |
index 6b52c879f3fc16a6fcbb82420e6b9f8279072e8f..f977a0cb3105303aecd66f87b6998b26dc3970e7 100644 |
--- a/src/zone/zone-chunk-list.h |
+++ b/src/zone/zone-chunk-list.h |
@@ -82,6 +82,8 @@ class ZoneChunkList : public ZoneObject { |
// TODO(heimbuef): Add 'rFind', seeking from the end and returning a |
// reverse iterator. |
+ void CopyTo(T* ptr); |
+ |
ForwardZoneChunkListIterator<T> begin(); |
ForwardZoneChunkListIterator<T> end(); |
ReverseZoneChunkListIterator<T> rbegin(); |
@@ -392,6 +394,19 @@ ForwardZoneChunkListIterator<const T> ZoneChunkList<T>::Find( |
} |
template <typename T> |
+void ZoneChunkList<T>::CopyTo(T* ptr) { |
+ for (Chunk* current = front_; current != nullptr; current = current->next_) { |
+ void* start = current->items(); |
+ void* end = current->items() + current->position_; |
+ size_t bytes = static_cast<size_t>(reinterpret_cast<uintptr_t>(end) - |
+ reinterpret_cast<uintptr_t>(start)); |
+ |
+ MemCopy(ptr, current->items(), bytes); |
+ ptr += current->position_; |
+ } |
+} |
+ |
+template <typename T> |
ForwardZoneChunkListIterator<T> ZoneChunkList<T>::begin() { |
return ForwardZoneChunkListIterator<T>::Begin(this); |
} |