| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef HeapAllocator_h | 5 #ifndef HeapAllocator_h |
| 6 #define HeapAllocator_h | 6 #define HeapAllocator_h |
| 7 | 7 |
| 8 #include "platform/heap/Heap.h" | 8 #include "platform/heap/Heap.h" |
| 9 #include "platform/heap/TraceTraits.h" | 9 #include "platform/heap/TraceTraits.h" |
| 10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 } | 401 } |
| 402 | 402 |
| 403 HeapDeque(size_t size, const T& val) : Deque<T, inlineCapacity, HeapAllocato
r>(size, val) | 403 HeapDeque(size_t size, const T& val) : Deque<T, inlineCapacity, HeapAllocato
r>(size, val) |
| 404 { | 404 { |
| 405 } | 405 } |
| 406 | 406 |
| 407 // FIXME: Doesn't work if there is an inline buffer, due to crbug.com/360572 | 407 // FIXME: Doesn't work if there is an inline buffer, due to crbug.com/360572 |
| 408 HeapDeque<T, 0>& operator=(const HeapDeque& other) | 408 HeapDeque<T, 0>& operator=(const HeapDeque& other) |
| 409 { | 409 { |
| 410 HeapDeque<T> copy(other); | 410 HeapDeque<T> copy(other); |
| 411 swap(copy); | 411 Deque<T, inlineCapacity, HeapAllocator>::swap(copy); |
| 412 return *this; | 412 return *this; |
| 413 } | 413 } |
| 414 | 414 |
| 415 // FIXME: Doesn't work if there is an inline buffer, due to crbug.com/360572 | |
| 416 void swap(HeapDeque& other) | |
| 417 { | |
| 418 Deque<T, inlineCapacity, HeapAllocator>::swap(other); | |
| 419 } | |
| 420 | |
| 421 template<size_t otherCapacity> | 415 template<size_t otherCapacity> |
| 422 HeapDeque(const HeapDeque<T, otherCapacity>& other) | 416 HeapDeque(const HeapDeque<T, otherCapacity>& other) |
| 423 : Deque<T, inlineCapacity, HeapAllocator>(other) | 417 : Deque<T, inlineCapacity, HeapAllocator>(other) |
| 424 { | 418 { |
| 425 } | 419 } |
| 426 | |
| 427 template<typename U> | |
| 428 void append(const U& other) | |
| 429 { | |
| 430 Deque<T, inlineCapacity, HeapAllocator>::append(other); | |
| 431 } | |
| 432 }; | 420 }; |
| 433 | 421 |
| 434 template<typename T, size_t i> | 422 template<typename T, size_t i> |
| 435 inline void swap(HeapVector<T, i>& a, HeapVector<T, i>& b) { a.swap(b); } | 423 inline void swap(HeapVector<T, i>& a, HeapVector<T, i>& b) { a.swap(b); } |
| 436 template<typename T, size_t i> | 424 template<typename T, size_t i> |
| 437 inline void swap(HeapDeque<T, i>& a, HeapDeque<T, i>& b) { a.swap(b); } | 425 inline void swap(HeapDeque<T, i>& a, HeapDeque<T, i>& b) { a.swap(b); } |
| 438 template<typename T, typename U, typename V> | 426 template<typename T, typename U, typename V> |
| 439 inline void swap(HeapHashSet<T, U, V>& a, HeapHashSet<T, U, V>& b) { a.swap(b);
} | 427 inline void swap(HeapHashSet<T, U, V>& a, HeapHashSet<T, U, V>& b) { a.swap(b);
} |
| 440 template<typename T, typename U, typename V, typename W, typename X> | 428 template<typename T, typename U, typename V, typename W, typename X> |
| 441 inline void swap(HeapHashMap<T, U, V, W, X>& a, HeapHashMap<T, U, V, W, X>& b) {
a.swap(b); } | 429 inline void swap(HeapHashMap<T, U, V, W, X>& a, HeapHashMap<T, U, V, W, X>& b) {
a.swap(b); } |
| 442 template<typename T, size_t i, typename U> | 430 template<typename T, size_t i, typename U> |
| 443 inline void swap(HeapListHashSet<T, i, U>& a, HeapListHashSet<T, i, U>& b) { a.s
wap(b); } | 431 inline void swap(HeapListHashSet<T, i, U>& a, HeapListHashSet<T, i, U>& b) { a.s
wap(b); } |
| 444 template<typename T, typename U, typename V> | 432 template<typename T, typename U, typename V> |
| 445 inline void swap(HeapLinkedHashSet<T, U, V>& a, HeapLinkedHashSet<T, U, V>& b) {
a.swap(b); } | 433 inline void swap(HeapLinkedHashSet<T, U, V>& a, HeapLinkedHashSet<T, U, V>& b) {
a.swap(b); } |
| 446 template<typename T, typename U, typename V> | 434 template<typename T, typename U, typename V> |
| 447 inline void swap(HeapHashCountedSet<T, U, V>& a, HeapHashCountedSet<T, U, V>& b)
{ a.swap(b); } | 435 inline void swap(HeapHashCountedSet<T, U, V>& a, HeapHashCountedSet<T, U, V>& b)
{ a.swap(b); } |
| 448 | 436 |
| 449 } // namespace blink | 437 } // namespace blink |
| 450 | 438 |
| 451 #endif | 439 #endif |
| OLD | NEW |