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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 static const bool canMoveWithMemcpy = VectorTraits<T>::canMoveWithMemcpy; | 459 static const bool canMoveWithMemcpy = VectorTraits<T>::canMoveWithMemcpy; |
460 }; | 460 }; |
461 | 461 |
462 template<typename T> struct HashTraits<blink::Member<T>> : SimpleClassHashTraits
<blink::Member<T>> { | 462 template<typename T> struct HashTraits<blink::Member<T>> : SimpleClassHashTraits
<blink::Member<T>> { |
463 STATIC_ONLY(HashTraits); | 463 STATIC_ONLY(HashTraits); |
464 // FIXME: The distinction between PeekInType and PassInType is there for | 464 // FIXME: The distinction between PeekInType and PassInType is there for |
465 // the sake of the reference counting handles. When they are gone the two | 465 // the sake of the reference counting handles. When they are gone the two |
466 // types can be merged into PassInType. | 466 // types can be merged into PassInType. |
467 // FIXME: Implement proper const'ness for iterator types. Requires support | 467 // FIXME: Implement proper const'ness for iterator types. Requires support |
468 // in the marking Visitor. | 468 // in the marking Visitor. |
469 using PeekInType = RawPtr<T>; | 469 using PeekInType = T*; |
470 using PassInType = RawPtr<T>; | 470 using PassInType = T*; |
471 using IteratorGetType = blink::Member<T>*; | 471 using IteratorGetType = blink::Member<T>*; |
472 using IteratorConstGetType = const blink::Member<T>*; | 472 using IteratorConstGetType = const blink::Member<T>*; |
473 using IteratorReferenceType = blink::Member<T>&; | 473 using IteratorReferenceType = blink::Member<T>&; |
474 using IteratorConstReferenceType = const blink::Member<T>&; | 474 using IteratorConstReferenceType = const blink::Member<T>&; |
475 static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { r
eturn *x; } | 475 static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { r
eturn *x; } |
476 static IteratorConstReferenceType getToReferenceConstConversion(IteratorCons
tGetType x) { return *x; } | 476 static IteratorConstReferenceType getToReferenceConstConversion(IteratorCons
tGetType x) { return *x; } |
477 // FIXME: Similarly, there is no need for a distinction between PeekOutType | 477 // FIXME: Similarly, there is no need for a distinction between PeekOutType |
478 // and PassOutType without reference counting. | 478 // and PassOutType without reference counting. |
479 using PeekOutType = T*; | 479 using PeekOutType = T*; |
480 using PassOutType = T*; | 480 using PassOutType = T*; |
481 | 481 |
482 template<typename U> | 482 template<typename U> |
483 static void store(const U& value, blink::Member<T>& storage) { storage = val
ue; } | 483 static void store(const U& value, blink::Member<T>& storage) { storage = val
ue; } |
484 | 484 |
485 static PeekOutType peek(const blink::Member<T>& value) { return value; } | 485 static PeekOutType peek(const blink::Member<T>& value) { return value; } |
486 static PassOutType passOut(const blink::Member<T>& value) { return value; } | 486 static PassOutType passOut(const blink::Member<T>& value) { return value; } |
487 }; | 487 }; |
488 | 488 |
489 template<typename T> struct HashTraits<blink::WeakMember<T>> : SimpleClassHashTr
aits<blink::WeakMember<T>> { | 489 template<typename T> struct HashTraits<blink::WeakMember<T>> : SimpleClassHashTr
aits<blink::WeakMember<T>> { |
490 STATIC_ONLY(HashTraits); | 490 STATIC_ONLY(HashTraits); |
491 static const bool needsDestruction = false; | 491 static const bool needsDestruction = false; |
492 // FIXME: The distinction between PeekInType and PassInType is there for | 492 // FIXME: The distinction between PeekInType and PassInType is there for |
493 // the sake of the reference counting handles. When they are gone the two | 493 // the sake of the reference counting handles. When they are gone the two |
494 // types can be merged into PassInType. | 494 // types can be merged into PassInType. |
495 // FIXME: Implement proper const'ness for iterator types. Requires support | 495 // FIXME: Implement proper const'ness for iterator types. Requires support |
496 // in the marking Visitor. | 496 // in the marking Visitor. |
497 using PeekInType = RawPtr<T>; | 497 using PeekInType = T*; |
498 using PassInType = RawPtr<T>; | 498 using PassInType = T*; |
499 using IteratorGetType = blink::WeakMember<T>*; | 499 using IteratorGetType = blink::WeakMember<T>*; |
500 using IteratorConstGetType = const blink::WeakMember<T>*; | 500 using IteratorConstGetType = const blink::WeakMember<T>*; |
501 using IteratorReferenceType = blink::WeakMember<T>&; | 501 using IteratorReferenceType = blink::WeakMember<T>&; |
502 using IteratorConstReferenceType = const blink::WeakMember<T>&; | 502 using IteratorConstReferenceType = const blink::WeakMember<T>&; |
503 static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { r
eturn *x; } | 503 static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { r
eturn *x; } |
504 static IteratorConstReferenceType getToReferenceConstConversion(IteratorCons
tGetType x) { return *x; } | 504 static IteratorConstReferenceType getToReferenceConstConversion(IteratorCons
tGetType x) { return *x; } |
505 // FIXME: Similarly, there is no need for a distinction between PeekOutType | 505 // FIXME: Similarly, there is no need for a distinction between PeekOutType |
506 // and PassOutType without reference counting. | 506 // and PassOutType without reference counting. |
507 using PeekOutType = T*; | 507 using PeekOutType = T*; |
508 using PassOutType = T*; | 508 using PassOutType = T*; |
(...skipping 15 matching lines...) Expand all Loading... |
524 } | 524 } |
525 }; | 525 }; |
526 | 526 |
527 template<typename T> struct HashTraits<blink::UntracedMember<T>> : SimpleClassHa
shTraits<blink::UntracedMember<T>> { | 527 template<typename T> struct HashTraits<blink::UntracedMember<T>> : SimpleClassHa
shTraits<blink::UntracedMember<T>> { |
528 STATIC_ONLY(HashTraits); | 528 STATIC_ONLY(HashTraits); |
529 static const bool needsDestruction = false; | 529 static const bool needsDestruction = false; |
530 // FIXME: The distinction between PeekInType and PassInType is there for | 530 // FIXME: The distinction between PeekInType and PassInType is there for |
531 // the sake of the reference counting handles. When they are gone the two | 531 // the sake of the reference counting handles. When they are gone the two |
532 // types can be merged into PassInType. | 532 // types can be merged into PassInType. |
533 // FIXME: Implement proper const'ness for iterator types. | 533 // FIXME: Implement proper const'ness for iterator types. |
534 using PeekInType = RawPtr<T>; | 534 using PeekInType = T*; |
535 using PassInType = RawPtr<T>; | 535 using PassInType = T*; |
536 using IteratorGetType = blink::UntracedMember<T>*; | 536 using IteratorGetType = blink::UntracedMember<T>*; |
537 using IteratorConstGetType = const blink::UntracedMember<T>*; | 537 using IteratorConstGetType = const blink::UntracedMember<T>*; |
538 using IteratorReferenceType = blink::UntracedMember<T>&; | 538 using IteratorReferenceType = blink::UntracedMember<T>&; |
539 using IteratorConstReferenceType = const blink::UntracedMember<T>&; | 539 using IteratorConstReferenceType = const blink::UntracedMember<T>&; |
540 static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { r
eturn *x; } | 540 static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { r
eturn *x; } |
541 static IteratorConstReferenceType getToReferenceConstConversion(IteratorCons
tGetType x) { return *x; } | 541 static IteratorConstReferenceType getToReferenceConstConversion(IteratorCons
tGetType x) { return *x; } |
542 // FIXME: Similarly, there is no need for a distinction between PeekOutType | 542 // FIXME: Similarly, there is no need for a distinction between PeekOutType |
543 // and PassOutType without reference counting. | 543 // and PassOutType without reference counting. |
544 using PeekOutType = T*; | 544 using PeekOutType = T*; |
545 using PassOutType = T*; | 545 using PassOutType = T*; |
(...skipping 11 matching lines...) Expand all Loading... |
557 static_assert(sizeof(T), "T must be fully defined"); | 557 static_assert(sizeof(T), "T must be fully defined"); |
558 // All heap allocated node pointers need visiting to keep the nodes alive, | 558 // All heap allocated node pointers need visiting to keep the nodes alive, |
559 // regardless of whether they contain pointers to other heap allocated | 559 // regardless of whether they contain pointers to other heap allocated |
560 // objects. | 560 // objects. |
561 static const bool value = true; | 561 static const bool value = true; |
562 }; | 562 }; |
563 | 563 |
564 } // namespace WTF | 564 } // namespace WTF |
565 | 565 |
566 #endif | 566 #endif |
OLD | NEW |