Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: sky/engine/platform/heap/Handle.h

Issue 679113005: Hollow out more of the tracing system in oilpan (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/css/FontFaceSet.cpp ('k') | sky/engine/platform/heap/Heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 void clear() { m_raw = 0; } 570 void clear() { m_raw = 0; }
571 571
572 572
573 protected: 573 protected:
574 void verifyTypeIsGarbageCollected() const 574 void verifyTypeIsGarbageCollected() const
575 { 575 {
576 } 576 }
577 577
578 T* m_raw; 578 T* m_raw;
579 579
580 template<bool x, WTF::WeakHandlingFlag y, WTF::ShouldWeakPointersBeMarkedStr ongly z, typename U, typename V> friend struct CollectionBackingTraceTrait;
581 friend class Visitor; 580 friend class Visitor;
582 }; 581 };
583 582
584 template<typename T> 583 template<typename T>
585 class TraceTrait<Member<T> > { 584 class TraceTrait<Member<T> > {
586 public: 585 public:
587 static void trace(Visitor* visitor, void* self) 586 static void trace(Visitor* visitor, void* self)
588 { 587 {
589 TraceTrait<T>::mark(visitor, *static_cast<Member<T>*>(self)); 588 TraceTrait<T>::mark(visitor, *static_cast<Member<T>*>(self));
590 } 589 }
(...skipping 12 matching lines...) Expand all
603 602
604 template<typename T> 603 template<typename T>
605 class TraceTrait<OwnPtr<T> > { 604 class TraceTrait<OwnPtr<T> > {
606 public: 605 public:
607 static void trace(Visitor* visitor, OwnPtr<T>* ptr) 606 static void trace(Visitor* visitor, OwnPtr<T>* ptr)
608 { 607 {
609 ASSERT_NOT_REACHED(); 608 ASSERT_NOT_REACHED();
610 } 609 }
611 }; 610 };
612 611
613 template<typename T, bool needsTracing>
614 struct TraceIfEnabled;
615
616 template<typename T>
617 struct TraceIfEnabled<T, false> {
618 static void trace(Visitor*, T*) { }
619 };
620
621 template<typename T>
622 struct TraceIfEnabled<T, true> {
623 static void trace(Visitor* visitor, T* t)
624 {
625 visitor->trace(*t);
626 }
627 };
628
629 template <typename T> struct RemoveHeapPointerWrapperTypes { 612 template <typename T> struct RemoveHeapPointerWrapperTypes {
630 typedef typename WTF::RemoveTemplate<typename WTF::RemoveTemplate<typename W TF::RemoveTemplate<T, Member>::Type, WeakMember>::Type, RawPtr>::Type Type; 613 typedef typename WTF::RemoveTemplate<typename WTF::RemoveTemplate<typename W TF::RemoveTemplate<T, Member>::Type, WeakMember>::Type, RawPtr>::Type Type;
631 }; 614 };
632 615
633 // FIXME: Oilpan: TraceIfNeeded should be implemented ala:
634 // NeedsTracing<T>::value || IsWeakMember<T>::value. It should not need to test
635 // raw pointer types. To remove these tests, we may need support for
636 // instantiating a template with a RawPtrOrMember'ish template.
637 template<typename T>
638 struct TraceIfNeeded : public TraceIfEnabled<T, false> { };
639
640 // This trace trait for std::pair will null weak members if their referent is 616 // This trace trait for std::pair will null weak members if their referent is
641 // collected. If you have a collection that contain weakness it does not remove 617 // collected. If you have a collection that contain weakness it does not remove
642 // entries from the collection that contain nulled weak members. 618 // entries from the collection that contain nulled weak members.
643 template<typename T, typename U> 619 template<typename T, typename U>
644 class TraceTrait<std::pair<T, U> > { 620 class TraceTrait<std::pair<T, U> > {
645 public: 621 public:
646 static const bool firstNeedsTracing = WTF::NeedsTracing<T>::value || WTF::Is Weak<T>::value;
647 static const bool secondNeedsTracing = WTF::NeedsTracing<U>::value || WTF::I sWeak<U>::value;
648 static void trace(Visitor* visitor, std::pair<T, U>* pair) 622 static void trace(Visitor* visitor, std::pair<T, U>* pair)
649 { 623 {
650 TraceIfEnabled<T, firstNeedsTracing>::trace(visitor, &pair->first);
651 TraceIfEnabled<U, secondNeedsTracing>::trace(visitor, &pair->second);
652 } 624 }
653 }; 625 };
654 626
655 // WeakMember is similar to Member in that it is used to point to other oilpan 627 // WeakMember is similar to Member in that it is used to point to other oilpan
656 // heap allocated objects. 628 // heap allocated objects.
657 // However instead of creating a strong pointer to the object, the WeakMember cr eates 629 // However instead of creating a strong pointer to the object, the WeakMember cr eates
658 // a weak pointer, which does not keep the pointee alive. Hence if all pointers to 630 // a weak pointer, which does not keep the pointee alive. Hence if all pointers to
659 // to a heap allocated object are weak the object will be garbage collected. At the 631 // to a heap allocated object are weak the object will be garbage collected. At the
660 // time of GC the weak pointers will automatically be set to null. 632 // time of GC the weak pointers will automatically be set to null.
661 template<typename T> 633 template<typename T>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 // Comparison operators between (Weak)Members and Persistents 692 // Comparison operators between (Weak)Members and Persistents
721 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons t Member<U>& b) { return a.get() == b.get(); } 693 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons t Member<U>& b) { return a.get() == b.get(); }
722 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons t Member<U>& b) { return a.get() != b.get(); } 694 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons t Member<U>& b) { return a.get() != b.get(); }
723 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons t Persistent<U>& b) { return a.get() == b.get(); } 695 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons t Persistent<U>& b) { return a.get() == b.get(); }
724 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons t Persistent<U>& b) { return a.get() != b.get(); } 696 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons t Persistent<U>& b) { return a.get() != b.get(); }
725 template<typename T, typename U> inline bool operator==(const Persistent<T>& a, const Member<U>& b) { return a.get() == b.get(); } 697 template<typename T, typename U> inline bool operator==(const Persistent<T>& a, const Member<U>& b) { return a.get() == b.get(); }
726 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a, const Member<U>& b) { return a.get() != b.get(); } 698 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a, const Member<U>& b) { return a.get() != b.get(); }
727 template<typename T, typename U> inline bool operator==(const Persistent<T>& a, const Persistent<U>& b) { return a.get() == b.get(); } 699 template<typename T, typename U> inline bool operator==(const Persistent<T>& a, const Persistent<U>& b) { return a.get() == b.get(); }
728 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a, const Persistent<U>& b) { return a.get() != b.get(); } 700 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a, const Persistent<U>& b) { return a.get() != b.get(); }
729 701
730 // CPP-defined type names for the transition period where we want to
731 // support both reference counting and garbage collection based on a
732 // compile-time flag.
733 //
734 // C++11 template aliases were initially used (with clang only, not
735 // with GCC nor MSVC.) However, supporting both CPP defines and
736 // template aliases is problematic from outside a WebCore namespace
737 // when Oilpan is disabled: e.g.,
738 // blink::RefCountedWillBeGarbageCollected as a template alias would
739 // uniquely resolve from within any namespace, but if it is backed by
740 // a CPP #define, it would expand to blink::RefCounted, and not the
741 // required WTF::RefCounted.
742 //
743 // Having the CPP expansion instead be fully namespace qualified, and the
744 // transition type be unqualified, would dually not work for template
745 // aliases. So, slightly unfortunately, fall back/down to the lowest
746 // commmon denominator of using CPP macros only.
747 #if ENABLE(OILPAN)
748 #define PassRefPtrWillBeRawPtr WTF::RawPtr
749 #define RefCountedWillBeGarbageCollected blink::GarbageCollected
750 #define RefCountedWillBeGarbageCollectedFinalized blink::GarbageCollectedFinaliz ed
751 #define RefCountedWillBeRefCountedGarbageCollected blink::RefCountedGarbageColle cted
752 #define RefCountedGarbageCollectedWillBeGarbageCollectedFinalized blink::Garbage CollectedFinalized
753 #define ThreadSafeRefCountedWillBeGarbageCollected blink::GarbageCollected
754 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized blink::GarbageCollec tedFinalized
755 #define ThreadSafeRefCountedWillBeThreadSafeRefCountedGarbageCollected blink::Th readSafeRefCountedGarbageCollected
756 #define PersistentWillBeMember blink::Member
757 #define RefPtrWillBePersistent blink::Persistent
758 #define RefPtrWillBeRawPtr WTF::RawPtr
759 #define RefPtrWillBeMember blink::Member
760 #define RefPtrWillBeWeakMember blink::WeakMember
761 #define RefPtrWillBeCrossThreadPersistent blink::CrossThreadPersistent
762 #define RawPtrWillBeMember blink::Member
763 #define RawPtrWillBePersistent blink::Persistent
764 #define RawPtrWillBeWeakMember blink::WeakMember
765 #define OwnPtrWillBeMember blink::Member
766 #define OwnPtrWillBePersistent blink::Persistent
767 #define OwnPtrWillBeRawPtr WTF::RawPtr
768 #define PassOwnPtrWillBeRawPtr WTF::RawPtr
769 #define WeakPtrWillBeMember blink::Member
770 #define WeakPtrWillBeRawPtr WTF::RawPtr
771 #define WeakPtrWillBeMember blink::Member
772 #define WeakPtrWillBeWeakMember blink::WeakMember
773 #define NoBaseWillBeGarbageCollected blink::GarbageCollected
774 #define NoBaseWillBeGarbageCollectedFinalized blink::GarbageCollectedFinalized
775 #define NoBaseWillBeRefCountedGarbageCollected blink::RefCountedGarbageCollected
776 #define WillBeHeapHashMap blink::HeapHashMap
777 #define WillBePersistentHeapHashMap blink::PersistentHeapHashMap
778 #define WillBeHeapHashSet blink::HeapHashSet
779 #define WillBePersistentHeapHashSet blink::PersistentHeapHashSet
780 #define WillBeHeapLinkedHashSet blink::HeapLinkedHashSet
781 #define WillBePersistentHeapLinkedHashSet blink::PersistentHeapLinkedHashSet
782 #define WillBeHeapListHashSet blink::HeapListHashSet
783 #define WillBePersistentHeapListHashSet blink::PersistentHeapListHashSet
784 #define WillBeHeapVector blink::HeapVector
785 #define WillBePersistentHeapVector blink::PersistentHeapVector
786 #define WillBeHeapDeque blink::HeapDeque
787 #define WillBePersistentHeapDeque blink::PersistentHeapDeque
788 #define WillBeHeapHashCountedSet blink::HeapHashCountedSet
789 #define WillBePersistentHeapHashCountedSet blink::PersistentHeapHashCountedSet
790 #define WillBeGarbageCollectedMixin blink::GarbageCollectedMixin
791 #define WillBeHeapSupplement blink::HeapSupplement
792 #define WillBeHeapSupplementable blink::HeapSupplementable
793 #define WillBePersistentHeapSupplementable blink::PersistentHeapSupplementable
794 #define WillBeHeapTerminatedArray blink::HeapTerminatedArray
795 #define WillBeHeapTerminatedArrayBuilder blink::HeapTerminatedArrayBuilder
796 #define WillBeHeapLinkedStack blink::HeapLinkedStack
797 #define PersistentHeapHashSetWillBeHeapHashSet blink::HeapHashSet
798 #define PersistentHeapDequeWillBeHeapDeque blink::HeapDeque
799 #define PersistentHeapVectorWillBeHeapVector blink::HeapVector
800
801 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeNoop(T* ptr)
802 {
803 static const bool notRefCountedGarbageCollected = !WTF::IsSubclassOfTemplate <typename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value;
804 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value;
805 COMPILE_ASSERT(notRefCountedGarbageCollected, useAdoptRefCountedWillBeRefCou ntedGarbageCollected);
806 COMPILE_ASSERT(notRefCounted, youMustAdopt);
807 return PassRefPtrWillBeRawPtr<T>(ptr);
808 }
809
810 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeRefCountedGarbageCo llected(T* ptr)
811 {
812 static const bool isRefCountedGarbageCollected = WTF::IsSubclassOfTemplate<t ypename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value;
813 COMPILE_ASSERT(isRefCountedGarbageCollected, useAdoptRefWillBeNoop);
814 return PassRefPtrWillBeRawPtr<T>(adoptRefCountedGarbageCollected(ptr));
815 }
816
817 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeThreadSafeRefCounte dGarbageCollected(T* ptr)
818 {
819 static const bool isThreadSafeRefCountedGarbageCollected = WTF::IsSubclassOf Template<typename WTF::RemoveConst<T>::Type, ThreadSafeRefCountedGarbageCollecte d>::value;
820 COMPILE_ASSERT(isThreadSafeRefCountedGarbageCollected, useAdoptRefWillBeNoop );
821 return PassRefPtrWillBeRawPtr<T>(adoptRefCountedGarbageCollected(ptr));
822 }
823
824 template<typename T> PassOwnPtrWillBeRawPtr<T> adoptPtrWillBeNoop(T* ptr)
825 {
826 static const bool notRefCountedGarbageCollected = !WTF::IsSubclassOfTemplate <typename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value;
827 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value;
828 COMPILE_ASSERT(notRefCountedGarbageCollected, useAdoptRefCountedWillBeRefCou ntedGarbageCollected);
829 COMPILE_ASSERT(notRefCounted, youMustAdopt);
830 return PassOwnPtrWillBeRawPtr<T>(ptr);
831 }
832
833 template<typename T> T* adoptPtrWillBeRefCountedGarbageCollected(T* ptr)
834 {
835 static const bool isRefCountedGarbageCollected = WTF::IsSubclassOfTemplate<t ypename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value;
836 COMPILE_ASSERT(isRefCountedGarbageCollected, useAdoptRefWillBeNoop);
837 return adoptRefCountedGarbageCollected(ptr);
838 }
839
840 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED // do nothing when oilpan is ena bled.
841 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing
842 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing
843 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing
844
845 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \
846 static type* name = (new Persistent<type>(arguments))->get();
847
848 #else // !ENABLE(OILPAN)
849 702
850 template<typename T> 703 template<typename T>
851 class DummyBase { 704 class DummyBase {
852 public: 705 public:
853 DummyBase() { } 706 DummyBase() { }
854 ~DummyBase() { } 707 ~DummyBase() { }
855 }; 708 };
856 709
857 #define PassRefPtrWillBeRawPtr WTF::PassRefPtr
858 #define RefCountedWillBeGarbageCollected WTF::RefCounted
859 #define RefCountedWillBeGarbageCollectedFinalized WTF::RefCounted
860 #define RefCountedWillBeRefCountedGarbageCollected WTF::RefCounted
861 #define RefCountedGarbageCollectedWillBeGarbageCollectedFinalized blink::RefCoun tedGarbageCollected
862 #define ThreadSafeRefCountedWillBeGarbageCollected WTF::ThreadSafeRefCounted
863 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WTF::ThreadSafeRefCo unted
864 #define ThreadSafeRefCountedWillBeThreadSafeRefCountedGarbageCollected WTF::Thre adSafeRefCounted
865 #define PersistentWillBeMember blink::Persistent
866 #define RefPtrWillBePersistent WTF::RefPtr
867 #define RefPtrWillBeRawPtr WTF::RefPtr
868 #define RefPtrWillBeMember WTF::RefPtr
869 #define RefPtrWillBeWeakMember WTF::RefPtr
870 #define RefPtrWillBeCrossThreadPersistent WTF::RefPtr
871 #define RawPtrWillBeMember WTF::RawPtr
872 #define RawPtrWillBePersistent WTF::RawPtr
873 #define RawPtrWillBeWeakMember WTF::RawPtr
874 #define OwnPtrWillBeMember WTF::OwnPtr
875 #define OwnPtrWillBePersistent WTF::OwnPtr
876 #define OwnPtrWillBeRawPtr WTF::OwnPtr
877 #define PassOwnPtrWillBeRawPtr WTF::PassOwnPtr
878 #define WeakPtrWillBeMember WTF::WeakPtr
879 #define WeakPtrWillBeRawPtr WTF::WeakPtr
880 #define WeakPtrWillBeMember WTF::WeakPtr
881 #define WeakPtrWillBeWeakMember WTF::WeakPtr
882 #define NoBaseWillBeGarbageCollected blink::DummyBase
883 #define NoBaseWillBeGarbageCollectedFinalized blink::DummyBase
884 #define NoBaseWillBeRefCountedGarbageCollected blink::DummyBase
885 #define WillBeHeapHashMap WTF::HashMap
886 #define WillBePersistentHeapHashMap WTF::HashMap
887 #define WillBeHeapHashSet WTF::HashSet
888 #define WillBePersistentHeapHashSet WTF::HashSet
889 #define WillBeHeapLinkedHashSet WTF::LinkedHashSet
890 #define WillBePersistentLinkedHeapHashSet WTF::LinkedHashSet
891 #define WillBeHeapListHashSet WTF::ListHashSet
892 #define WillBePersistentListHeapHashSet WTF::ListHashSet
893 #define WillBeHeapVector WTF::Vector
894 #define WillBePersistentHeapVector WTF::Vector
895 #define WillBeHeapDeque WTF::Deque
896 #define WillBePersistentHeapDeque WTF::Deque
897 #define WillBeHeapHashCountedSet WTF::HashCountedSet
898 #define WillBePersistentHeapHashCountedSet WTF::HashCountedSet
899 #define WillBeGarbageCollectedMixin blink::DummyBase<void>
900 #define WillBeHeapSupplement blink::Supplement
901 #define WillBeHeapSupplementable blink::Supplementable
902 #define WillBePersistentHeapSupplementable blink::Supplementable
903 #define WillBeHeapTerminatedArray WTF::TerminatedArray
904 #define WillBeHeapTerminatedArrayBuilder WTF::TerminatedArrayBuilder
905 #define WillBeHeapLinkedStack WTF::LinkedStack
906 #define PersistentHeapHashSetWillBeHeapHashSet blink::PersistentHeapHashSet
907 #define PersistentHeapDequeWillBeHeapDeque blink::PersistentHeapDeque
908 #define PersistentHeapVectorWillBeHeapVector blink::PersistentHeapVector
909
910 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeNoop(T* ptr) { retu rn adoptRef(ptr); }
911 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeRefCountedGarbageCo llected(T* ptr) { return adoptRef(ptr); }
912 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeThreadSafeRefCounte dGarbageCollected(T* ptr) { return adoptRef(ptr); }
913 template<typename T> PassOwnPtrWillBeRawPtr<T> adoptPtrWillBeNoop(T* ptr) { retu rn adoptPtr(ptr); }
914 template<typename T> PassOwnPtrWillBeRawPtr<T> adoptPtrWillBeRefCountedGarbageCo llected(T* ptr) { return adoptPtr(ptr); }
915
916
917 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED WTF_MAKE_FAST_ALLOCATED 710 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED WTF_MAKE_FAST_ALLOCATED
918 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ 711 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \
919 public: \ 712 public: \
920 ~type(); \ 713 ~type(); \
921 private: 714 private:
922 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) \ 715 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) \
923 public: \ 716 public: \
924 virtual ~type(); \ 717 virtual ~type(); \
925 private: 718 private:
926 719
927 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ 720 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \
928 type::~type() { } 721 type::~type() { }
929 722
930 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \ 723 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \
931 DEFINE_STATIC_REF(type, name, arguments) 724 DEFINE_STATIC_REF(type, name, arguments)
932 725
933 #endif // ENABLE(OILPAN)
934
935 } // namespace blink 726 } // namespace blink
936 727
937 namespace WTF { 728 namespace WTF {
938 729
939 template <typename T> struct VectorTraits<blink::Member<T> > : VectorTraitsBase< blink::Member<T> > { 730 template <typename T> struct VectorTraits<blink::Member<T> > : VectorTraitsBase< blink::Member<T> > {
940 static const bool needsDestruction = false; 731 static const bool needsDestruction = false;
941 static const bool canInitializeWithMemset = true; 732 static const bool canInitializeWithMemset = true;
942 static const bool canMoveWithMemcpy = true; 733 static const bool canMoveWithMemcpy = true;
943 }; 734 };
944 735
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 typedef T* PeekOutType; 810 typedef T* PeekOutType;
1020 typedef T* PassOutType; 811 typedef T* PassOutType;
1021 812
1022 template<typename U> 813 template<typename U>
1023 static void store(const U& value, blink::WeakMember<T>& storage) { storage = value; } 814 static void store(const U& value, blink::WeakMember<T>& storage) { storage = value; }
1024 815
1025 static PeekOutType peek(const blink::WeakMember<T>& value) { return value; } 816 static PeekOutType peek(const blink::WeakMember<T>& value) { return value; }
1026 static PassOutType passOut(const blink::WeakMember<T>& value) { return value ; } 817 static PassOutType passOut(const blink::WeakMember<T>& value) { return value ; }
1027 static bool traceInCollection(blink::Visitor* visitor, blink::WeakMember<T>& weakMember, ShouldWeakPointersBeMarkedStrongly strongify) 818 static bool traceInCollection(blink::Visitor* visitor, blink::WeakMember<T>& weakMember, ShouldWeakPointersBeMarkedStrongly strongify)
1028 { 819 {
1029 if (strongify == WeakPointersActStrong) {
1030 visitor->trace(reinterpret_cast<blink::Member<T>&>(weakMember)); // Strongified visit.
1031 return false;
1032 }
1033 return !visitor->isAlive(weakMember);
1034 } 820 }
1035 }; 821 };
1036 822
1037 template<typename T> struct PtrHash<blink::Member<T> > : PtrHash<T*> { 823 template<typename T> struct PtrHash<blink::Member<T> > : PtrHash<T*> {
1038 template<typename U> 824 template<typename U>
1039 static unsigned hash(const U& key) { return PtrHash<T*>::hash(key); } 825 static unsigned hash(const U& key) { return PtrHash<T*>::hash(key); }
1040 static bool equal(T* a, const blink::Member<T>& b) { return a == b; } 826 static bool equal(T* a, const blink::Member<T>& b) { return a == b; }
1041 static bool equal(const blink::Member<T>& a, T* b) { return a == b; } 827 static bool equal(const blink::Member<T>& a, T* b) { return a == b; }
1042 template<typename U, typename V> 828 template<typename U, typename V>
1043 static bool equal(const U& a, const V& b) { return a == b; } 829 static bool equal(const U& a, const V& b) { return a == b; }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, false> { 905 struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, false> {
1120 }; 906 };
1121 907
1122 template<typename T> 908 template<typename T>
1123 struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, fal se> { 909 struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, fal se> {
1124 }; 910 };
1125 911
1126 } // namespace WTF 912 } // namespace WTF
1127 913
1128 #endif 914 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/css/FontFaceSet.cpp ('k') | sky/engine/platform/heap/Heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698