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

Side by Side Diff: Source/platform/heap/Handle.h

Issue 223373002: Create HeapLinkedHashSet and LinkedHashSet, ordered heap-friendly hash sets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix gtest-related compile error on gcc by removing internal typedefs in iterators Created 6 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 namespace WebCore { 43 namespace WebCore {
44 44
45 template<typename T> class HeapTerminatedArray; 45 template<typename T> class HeapTerminatedArray;
46 46
47 #define COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, ErrorMessage) \ 47 #define COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, ErrorMessage) \
48 do { \ 48 do { \
49 typedef typename WTF::RemoveConst<T>::Type NonConstType; \ 49 typedef typename WTF::RemoveConst<T>::Type NonConstType; \
50 typedef WTF::IsSubclassOfTemplate<NonConstType, GarbageCollected> Garbag eCollectedSubclass; \ 50 typedef WTF::IsSubclassOfTemplate<NonConstType, GarbageCollected> Garbag eCollectedSubclass; \
51 typedef WTF::IsSubclass<NonConstType, GarbageCollectedMixin> GarbageColl ectedMixinSubclass; \ 51 typedef WTF::IsSubclass<NonConstType, GarbageCollectedMixin> GarbageColl ectedMixinSubclass; \
52 typedef WTF::IsSubclassOfTemplate3<NonConstType, HeapHashSet> HeapHashSe tSubclass; \ 52 typedef WTF::IsSubclassOfTemplate3<NonConstType, HeapHashSet> HeapHashSe tSubclass; \
53 typedef WTF::IsSubclassOfTemplate3<NonConstType, HeapLinkedHashSet> Heap LinkedHashSetSubclass; \
53 typedef WTF::IsSubclassOfTemplate5<NonConstType, HeapHashMap> HeapHashMa pSubclass; \ 54 typedef WTF::IsSubclassOfTemplate5<NonConstType, HeapHashMap> HeapHashMa pSubclass; \
54 typedef WTF::IsSubclassOfTemplateTypenameSize<NonConstType, HeapVector> HeapVectorSubclass; \ 55 typedef WTF::IsSubclassOfTemplateTypenameSize<NonConstType, HeapVector> HeapVectorSubclass; \
55 typedef WTF::IsSubclassOfTemplateTypenameSize<NonConstType, HeapDeque> H eapDequeSubclass; \ 56 typedef WTF::IsSubclassOfTemplateTypenameSize<NonConstType, HeapDeque> H eapDequeSubclass; \
56 typedef WTF::IsSubclassOfTemplate<NonConstType, HeapTerminatedArray> Hea pTerminatedArraySubclass; \ 57 typedef WTF::IsSubclassOfTemplate<NonConstType, HeapTerminatedArray> Hea pTerminatedArraySubclass; \
57 COMPILE_ASSERT(GarbageCollectedSubclass::value || \ 58 COMPILE_ASSERT(GarbageCollectedSubclass::value || \
58 GarbageCollectedMixinSubclass::value || \ 59 GarbageCollectedMixinSubclass::value || \
59 HeapHashSetSubclass::value || \ 60 HeapHashSetSubclass::value || \
61 HeapLinkedHashSetSubclass::value || \
60 HeapHashMapSubclass::value || \ 62 HeapHashMapSubclass::value || \
61 HeapVectorSubclass::value || \ 63 HeapVectorSubclass::value || \
62 HeapDequeSubclass::value || \ 64 HeapDequeSubclass::value || \
63 HeapTerminatedArraySubclass::value, \ 65 HeapTerminatedArraySubclass::value, \
64 ErrorMessage); \ 66 ErrorMessage); \
65 } while (0) 67 } while (0)
66 68
67 template<typename T> class Member; 69 template<typename T> class Member;
68 70
69 class PersistentNode { 71 class PersistentNode {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 typename KeyTraitsArg = HashTraits<KeyArg>, 405 typename KeyTraitsArg = HashTraits<KeyArg>,
404 typename MappedTraitsArg = HashTraits<MappedArg> > 406 typename MappedTraitsArg = HashTraits<MappedArg> >
405 class PersistentHeapHashMap : public PersistentHeapCollectionBase<HeapHashMap<Ke yArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> > { }; 407 class PersistentHeapHashMap : public PersistentHeapCollectionBase<HeapHashMap<Ke yArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> > { };
406 408
407 template< 409 template<
408 typename ValueArg, 410 typename ValueArg,
409 typename HashArg = typename DefaultHash<ValueArg>::Hash, 411 typename HashArg = typename DefaultHash<ValueArg>::Hash,
410 typename TraitsArg = HashTraits<ValueArg> > 412 typename TraitsArg = HashTraits<ValueArg> >
411 class PersistentHeapHashSet : public PersistentHeapCollectionBase<HeapHashSet<Va lueArg, HashArg, TraitsArg> > { }; 413 class PersistentHeapHashSet : public PersistentHeapCollectionBase<HeapHashSet<Va lueArg, HashArg, TraitsArg> > { };
412 414
415 template<
416 typename ValueArg,
417 typename HashArg = typename DefaultHash<ValueArg>::Hash,
418 typename TraitsArg = HashTraits<ValueArg> >
419 class PersistentHeapLinkedHashSet : public PersistentHeapCollectionBase<HeapLink edHashSet<ValueArg, HashArg, TraitsArg> > { };
420
413 template<typename T, size_t inlineCapacity = 0> 421 template<typename T, size_t inlineCapacity = 0>
414 class PersistentHeapVector : public PersistentHeapCollectionBase<HeapVector<T, i nlineCapacity> > { 422 class PersistentHeapVector : public PersistentHeapCollectionBase<HeapVector<T, i nlineCapacity> > {
415 public: 423 public:
416 PersistentHeapVector() { } 424 PersistentHeapVector() { }
417 425
418 template<size_t otherCapacity> 426 template<size_t otherCapacity>
419 PersistentHeapVector(const HeapVector<T, otherCapacity>& other) 427 PersistentHeapVector(const HeapVector<T, otherCapacity>& other)
420 : PersistentHeapCollectionBase<HeapVector<T, inlineCapacity> >(other) 428 : PersistentHeapCollectionBase<HeapVector<T, inlineCapacity> >(other)
421 { 429 {
422 } 430 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 551
544 void swap(Member<T>& other) { std::swap(m_raw, other.m_raw); } 552 void swap(Member<T>& other) { std::swap(m_raw, other.m_raw); }
545 553
546 T* get() const { return m_raw; } 554 T* get() const { return m_raw; }
547 555
548 void clear() { m_raw = 0; } 556 void clear() { m_raw = 0; }
549 557
550 protected: 558 protected:
551 T* m_raw; 559 T* m_raw;
552 560
553 template<bool x, bool y, bool z, typename U, typename V> friend struct Colle ctionBackingTraceTrait; 561 template<bool x, bool y, ShouldWeakPointersBeMarkedStrongly z, typename U, t ypename V> friend struct CollectionBackingTraceTrait;
554 }; 562 };
555 563
556 template<typename T> 564 template<typename T>
557 class TraceTrait<Member<T> > { 565 class TraceTrait<Member<T> > {
558 public: 566 public:
559 static void trace(Visitor* visitor, void* self) 567 static void trace(Visitor* visitor, void* self)
560 { 568 {
561 TraceTrait<T>::mark(visitor, *static_cast<Member<T>*>(self)); 569 TraceTrait<T>::mark(visitor, *static_cast<Member<T>*>(self));
562 } 570 }
563 }; 571 };
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 #define OwnPtrWillBeMember WebCore::Member 742 #define OwnPtrWillBeMember WebCore::Member
735 #define OwnPtrWillBePersistent WebCore::Persistent 743 #define OwnPtrWillBePersistent WebCore::Persistent
736 #define OwnPtrWillBeRawPtr WTF::RawPtr 744 #define OwnPtrWillBeRawPtr WTF::RawPtr
737 #define PassOwnPtrWillBeRawPtr WTF::RawPtr 745 #define PassOwnPtrWillBeRawPtr WTF::RawPtr
738 #define NoBaseWillBeGarbageCollected WebCore::GarbageCollected 746 #define NoBaseWillBeGarbageCollected WebCore::GarbageCollected
739 #define NoBaseWillBeGarbageCollectedFinalized WebCore::GarbageCollectedFinalized 747 #define NoBaseWillBeGarbageCollectedFinalized WebCore::GarbageCollectedFinalized
740 #define WillBeHeapHashMap WebCore::HeapHashMap 748 #define WillBeHeapHashMap WebCore::HeapHashMap
741 #define WillBePersistentHeapHashMap WebCore::PersistentHeapHashMap 749 #define WillBePersistentHeapHashMap WebCore::PersistentHeapHashMap
742 #define WillBeHeapHashSet WebCore::HeapHashSet 750 #define WillBeHeapHashSet WebCore::HeapHashSet
743 #define WillBePersistentHeapHashSet WebCore::PersistentHeapHashSet 751 #define WillBePersistentHeapHashSet WebCore::PersistentHeapHashSet
752 #define WillBeHeapLinkedHashSet WebCore::HeapLinkedHashSet
753 #define WillBePersistentHeapLinkedHashSet WebCore::PersistentHeapLinkedHashSet
744 #define WillBeHeapVector WebCore::HeapVector 754 #define WillBeHeapVector WebCore::HeapVector
745 #define WillBePersistentHeapVector WebCore::PersistentHeapVector 755 #define WillBePersistentHeapVector WebCore::PersistentHeapVector
746 #define WillBeHeapDeque WebCore::HeapDeque 756 #define WillBeHeapDeque WebCore::HeapDeque
747 #define WillBePersistentHeapDeque WebCore::PersistentHeapDeque 757 #define WillBePersistentHeapDeque WebCore::PersistentHeapDeque
748 #define WillBeGarbageCollectedMixin WebCore::GarbageCollectedMixin 758 #define WillBeGarbageCollectedMixin WebCore::GarbageCollectedMixin
749 #define WillBeHeapSupplement WebCore::HeapSupplement 759 #define WillBeHeapSupplement WebCore::HeapSupplement
750 #define WillBeHeapSupplementable WebCore::HeapSupplementable 760 #define WillBeHeapSupplementable WebCore::HeapSupplementable
751 #define WillBeHeapTerminatedArray WebCore::HeapTerminatedArray 761 #define WillBeHeapTerminatedArray WebCore::HeapTerminatedArray
752 #define WillBeHeapTerminatedArrayBuilder WebCore::HeapTerminatedArrayBuilder 762 #define WillBeHeapTerminatedArrayBuilder WebCore::HeapTerminatedArrayBuilder
753 #define WillBeHeapLinkedStack WebCore::HeapLinkedStack 763 #define WillBeHeapLinkedStack WebCore::HeapLinkedStack
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 #define OwnPtrWillBeMember WTF::OwnPtr 817 #define OwnPtrWillBeMember WTF::OwnPtr
808 #define OwnPtrWillBePersistent WTF::OwnPtr 818 #define OwnPtrWillBePersistent WTF::OwnPtr
809 #define OwnPtrWillBeRawPtr WTF::OwnPtr 819 #define OwnPtrWillBeRawPtr WTF::OwnPtr
810 #define PassOwnPtrWillBeRawPtr WTF::PassOwnPtr 820 #define PassOwnPtrWillBeRawPtr WTF::PassOwnPtr
811 #define NoBaseWillBeGarbageCollected WebCore::DummyBase 821 #define NoBaseWillBeGarbageCollected WebCore::DummyBase
812 #define NoBaseWillBeGarbageCollectedFinalized WebCore::DummyBase 822 #define NoBaseWillBeGarbageCollectedFinalized WebCore::DummyBase
813 #define WillBeHeapHashMap WTF::HashMap 823 #define WillBeHeapHashMap WTF::HashMap
814 #define WillBePersistentHeapHashMap WTF::HashMap 824 #define WillBePersistentHeapHashMap WTF::HashMap
815 #define WillBeHeapHashSet WTF::HashSet 825 #define WillBeHeapHashSet WTF::HashSet
816 #define WillBePersistentHeapHashSet WTF::HashSet 826 #define WillBePersistentHeapHashSet WTF::HashSet
827 #define WillBeHeapLinkedHashSet WTF::LinkedHashSet
828 #define WillBePersistentLinkedHeapHashSet WTF::LinkedHashSet
817 #define WillBeHeapVector WTF::Vector 829 #define WillBeHeapVector WTF::Vector
818 #define WillBePersistentHeapVector WTF::Vector 830 #define WillBePersistentHeapVector WTF::Vector
819 #define WillBeHeapDeque WTF::Deque 831 #define WillBeHeapDeque WTF::Deque
820 #define WillBePersistentHeapDeque WTF::Deque 832 #define WillBePersistentHeapDeque WTF::Deque
821 #define WillBeGarbageCollectedMixin WebCore::DummyBase<void> 833 #define WillBeGarbageCollectedMixin WebCore::DummyBase<void>
822 #define WillBeHeapSupplement WebCore::Supplement 834 #define WillBeHeapSupplement WebCore::Supplement
823 #define WillBeHeapSupplementable WebCore::Supplementable 835 #define WillBeHeapSupplementable WebCore::Supplementable
824 #define WillBeHeapTerminatedArray WTF::TerminatedArray 836 #define WillBeHeapTerminatedArray WTF::TerminatedArray
825 #define WillBeHeapTerminatedArrayBuilder WTF::TerminatedArrayBuilder 837 #define WillBeHeapTerminatedArrayBuilder WTF::TerminatedArrayBuilder
826 #define WillBeHeapLinkedStack WTF::LinkedStack 838 #define WillBeHeapLinkedStack WTF::LinkedStack
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 template<typename T, size_t N> 1019 template<typename T, size_t N>
1008 struct NeedsTracing<Vector<T, N> > { 1020 struct NeedsTracing<Vector<T, N> > {
1009 static const bool value = false; 1021 static const bool value = false;
1010 }; 1022 };
1011 1023
1012 template<typename T, size_t N> 1024 template<typename T, size_t N>
1013 struct NeedsTracing<Deque<T, N> > { 1025 struct NeedsTracing<Deque<T, N> > {
1014 static const bool value = false; 1026 static const bool value = false;
1015 }; 1027 };
1016 1028
1017 template<typename T> 1029 template<typename T, typename U, typename V>
1018 struct NeedsTracing<HashSet<T> > { 1030 struct NeedsTracing<HashSet<T, U, V> > {
1019 static const bool value = false; 1031 static const bool value = false;
1020 }; 1032 };
1021 1033
1022 template<typename T> 1034 template<typename T, size_t U, typename V>
1023 struct NeedsTracing<ListHashSet<T> > { 1035 struct NeedsTracing<ListHashSet<T, U, V> > {
1024 static const bool value = false; 1036 static const bool value = false;
1025 }; 1037 };
1026 1038
1027 template<typename T, typename U> 1039 template<typename T, typename U, typename V>
1028 struct NeedsTracing<HashMap<T, U> > { 1040 struct NeedsTracing<LinkedHashSet<T, U, V> > {
1029 static const bool value = false; 1041 static const bool value = false;
1030 }; 1042 };
1031 1043
1044 template<typename T, typename U, typename V, typename W, typename X>
1045 struct NeedsTracing<HashMap<T, U, V, W, X> > {
1046 static const bool value = false;
1047 };
1048
1032 } // namespace WTF 1049 } // namespace WTF
1033 1050
1034 #endif 1051 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/platform/heap/Heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698