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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 }; | 415 }; |
416 | 416 |
417 template <typename T> struct VectorTraits<blink::UntracedMember<T>> : VectorTrai
tsBase<blink::UntracedMember<T>> { | 417 template <typename T> struct VectorTraits<blink::UntracedMember<T>> : VectorTrai
tsBase<blink::UntracedMember<T>> { |
418 STATIC_ONLY(VectorTraits); | 418 STATIC_ONLY(VectorTraits); |
419 static const bool needsDestruction = false; | 419 static const bool needsDestruction = false; |
420 static const bool canInitializeWithMemset = true; | 420 static const bool canInitializeWithMemset = true; |
421 static const bool canClearUnusedSlotsWithMemset = true; | 421 static const bool canClearUnusedSlotsWithMemset = true; |
422 static const bool canMoveWithMemcpy = true; | 422 static const bool canMoveWithMemcpy = true; |
423 }; | 423 }; |
424 | 424 |
| 425 template <typename T> struct VectorTraits<blink::CrossThreadPersistent<T>> : Vec
torTraitsBase<blink::CrossThreadPersistent<T>> { |
| 426 STATIC_ONLY(VectorTraits); |
| 427 static const bool needsDestruction = true; |
| 428 static const bool canInitializeWithMemset = false; |
| 429 static const bool canClearUnusedSlotsWithMemset = false; |
| 430 static const bool canMoveWithMemcpy = false; |
| 431 }; |
| 432 |
425 template <typename T> struct VectorTraits<blink::HeapVector<T, 0>> : VectorTrait
sBase<blink::HeapVector<T, 0>> { | 433 template <typename T> struct VectorTraits<blink::HeapVector<T, 0>> : VectorTrait
sBase<blink::HeapVector<T, 0>> { |
426 STATIC_ONLY(VectorTraits); | 434 STATIC_ONLY(VectorTraits); |
427 static const bool needsDestruction = false; | 435 static const bool needsDestruction = false; |
428 static const bool canInitializeWithMemset = true; | 436 static const bool canInitializeWithMemset = true; |
429 static const bool canClearUnusedSlotsWithMemset = true; | 437 static const bool canClearUnusedSlotsWithMemset = true; |
430 static const bool canMoveWithMemcpy = true; | 438 static const bool canMoveWithMemcpy = true; |
431 }; | 439 }; |
432 | 440 |
433 template <typename T> struct VectorTraits<blink::HeapDeque<T, 0>> : VectorTraits
Base<blink::HeapDeque<T, 0>> { | 441 template <typename T> struct VectorTraits<blink::HeapDeque<T, 0>> : VectorTraits
Base<blink::HeapDeque<T, 0>> { |
434 STATIC_ONLY(VectorTraits); | 442 STATIC_ONLY(VectorTraits); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 // regardless of whether they contain pointers to other heap allocated | 552 // regardless of whether they contain pointers to other heap allocated |
545 // objects. | 553 // objects. |
546 static const bool value = true; | 554 static const bool value = true; |
547 }; | 555 }; |
548 | 556 |
549 template<typename T, size_t inlineCapacity> | 557 template<typename T, size_t inlineCapacity> |
550 struct IsGarbageCollectedType<ListHashSetNode<T, blink::HeapListHashSetAllocator
<T, inlineCapacity>>> { | 558 struct IsGarbageCollectedType<ListHashSetNode<T, blink::HeapListHashSetAllocator
<T, inlineCapacity>>> { |
551 static const bool value = true; | 559 static const bool value = true; |
552 }; | 560 }; |
553 | 561 |
| 562 template<typename T> struct HashTraits<blink::CrossThreadPersistent<T>> : Simple
ClassHashTraits<blink::CrossThreadPersistent<T>> { |
| 563 STATIC_ONLY(HashTraits); |
| 564 // FIXME: The distinction between PeekInType and PassInType is there for |
| 565 // the sake of the reference counting handles. When they are gone the two |
| 566 // types can be merged into PassInType. |
| 567 // FIXME: Implement proper const'ness for iterator types. Requires support |
| 568 // in the marking Visitor. |
| 569 using PeekInType = T*; |
| 570 using PassInType = T*; |
| 571 using IteratorGetType = blink::Member<T>*; |
| 572 using IteratorConstGetType = const blink::CrossThreadPersistent<T>*; |
| 573 using IteratorReferenceType = blink::CrossThreadPersistent<T>&; |
| 574 using IteratorConstReferenceType = const blink::CrossThreadPersistent<T>&; |
| 575 static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { r
eturn *x; } |
| 576 static IteratorConstReferenceType getToReferenceConstConversion(IteratorCons
tGetType x) { return *x; } |
| 577 // FIXME: Similarly, there is no need for a distinction between PeekOutType |
| 578 // and PassOutType without reference counting. |
| 579 using PeekOutType = T*; |
| 580 using PassOutType = T*; |
| 581 |
| 582 template<typename U> |
| 583 static void store(const U& value, blink::CrossThreadPersistent<T>& storage)
{ storage = value; } |
| 584 |
| 585 static PeekOutType peek(const blink::CrossThreadPersistent<T>& value) { retu
rn value; } |
| 586 static PassOutType passOut(const blink::CrossThreadPersistent<T>& value) { r
eturn value; } |
| 587 }; |
| 588 |
554 } // namespace WTF | 589 } // namespace WTF |
555 | 590 |
556 #endif | 591 #endif |
OLD | NEW |