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/Allocator.h" | 10 #include "wtf/Allocator.h" |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 template<typename T, size_t inlineCapacity> | 565 template<typename T, size_t inlineCapacity> |
566 struct NeedsTracing<ListHashSetNode<T, blink::HeapListHashSetAllocator<T, inline
Capacity>> *> { | 566 struct NeedsTracing<ListHashSetNode<T, blink::HeapListHashSetAllocator<T, inline
Capacity>> *> { |
567 STATIC_ONLY(NeedsTracing); | 567 STATIC_ONLY(NeedsTracing); |
568 static_assert(sizeof(T), "T must be fully defined"); | 568 static_assert(sizeof(T), "T must be fully defined"); |
569 // All heap allocated node pointers need visiting to keep the nodes alive, | 569 // All heap allocated node pointers need visiting to keep the nodes alive, |
570 // regardless of whether they contain pointers to other heap allocated | 570 // regardless of whether they contain pointers to other heap allocated |
571 // objects. | 571 // objects. |
572 static const bool value = true; | 572 static const bool value = true; |
573 }; | 573 }; |
574 | 574 |
| 575 template<typename T> struct HashTraits<blink::CrossThreadPersistent<T>> : Simple
ClassHashTraits<blink::CrossThreadPersistent<T>> { |
| 576 STATIC_ONLY(HashTraits); |
| 577 // FIXME: The distinction between PeekInType and PassInType is there for |
| 578 // the sake of the reference counting handles. When they are gone the two |
| 579 // types can be merged into PassInType. |
| 580 // FIXME: Implement proper const'ness for iterator types. Requires support |
| 581 // in the marking Visitor. |
| 582 using PeekInType = T*; |
| 583 using PassInType = T*; |
| 584 using IteratorGetType = blink::Member<T>*; |
| 585 using IteratorConstGetType = const blink::CrossThreadPersistent<T>*; |
| 586 using IteratorReferenceType = blink::CrossThreadPersistent<T>&; |
| 587 using IteratorConstReferenceType = const blink::CrossThreadPersistent<T>&; |
| 588 static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { r
eturn *x; } |
| 589 static IteratorConstReferenceType getToReferenceConstConversion(IteratorCons
tGetType x) { return *x; } |
| 590 // FIXME: Similarly, there is no need for a distinction between PeekOutType |
| 591 // and PassOutType without reference counting. |
| 592 using PeekOutType = T*; |
| 593 using PassOutType = T*; |
| 594 |
| 595 template<typename U> |
| 596 static void store(const U& value, blink::CrossThreadPersistent<T>& storage)
{ storage = value; } |
| 597 |
| 598 static PeekOutType peek(const blink::CrossThreadPersistent<T>& value) { retu
rn value; } |
| 599 static PassOutType passOut(const blink::CrossThreadPersistent<T>& value) { r
eturn value; } |
| 600 }; |
| 601 |
575 } // namespace WTF | 602 } // namespace WTF |
576 | 603 |
577 #endif | 604 #endif |
OLD | NEW |