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

Side by Side Diff: Source/wtf/ListHashSet.h

Issue 274023002: Oilpan: Avoid declaring a destructor for garbage collected ListHashSet. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: macro fix Created 6 years, 7 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 | « Source/wtf/LinkedHashSet.h ('k') | no next file » | 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) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> 3 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 template<typename ValueArg> class ListHashSetNodeBase; 52 template<typename ValueArg> class ListHashSetNodeBase;
53 template<typename ValueArg, typename Allocator> class ListHashSetNode; 53 template<typename ValueArg, typename Allocator> class ListHashSetNode;
54 template<typename ValueArg, size_t inlineCapacity> struct ListHashSetAllocat or; 54 template<typename ValueArg, size_t inlineCapacity> struct ListHashSetAllocat or;
55 55
56 template<typename HashArg> struct ListHashSetNodeHashFunctions; 56 template<typename HashArg> struct ListHashSetNodeHashFunctions;
57 template<typename HashArg> struct ListHashSetTranslator; 57 template<typename HashArg> struct ListHashSetTranslator;
58 58
59 // Note that for a ListHashSet you cannot specify the HashTraits as a 59 // Note that for a ListHashSet you cannot specify the HashTraits as a
60 // template argument. It uses the default hash traits for the ValueArg 60 // template argument. It uses the default hash traits for the ValueArg
61 // type. 61 // type.
62 template<typename ValueArg, size_t inlineCapacity = 256, typename HashArg = typename DefaultHash<ValueArg>::Hash, typename AllocatorArg = ListHashSetAllocat or<ValueArg, inlineCapacity> > class ListHashSet { 62 template<typename ValueArg, size_t inlineCapacity = 256, typename HashArg = typename DefaultHash<ValueArg>::Hash, typename AllocatorArg = ListHashSetAllocat or<ValueArg, inlineCapacity> > class ListHashSet
63 : public HashTableDestructorBase<ListHashSet<ValueArg, inlineCapacity, H ashArg, AllocatorArg>, AllocatorArg::isGarbageCollected> {
63 typedef AllocatorArg Allocator; 64 typedef AllocatorArg Allocator;
64 WTF_USE_ALLOCATOR(ListHashSet, Allocator); 65 WTF_USE_ALLOCATOR(ListHashSet, Allocator);
65 66
66 typedef ListHashSetNode<ValueArg, Allocator> Node; 67 typedef ListHashSetNode<ValueArg, Allocator> Node;
67 typedef HashTraits<Node*> NodeTraits; 68 typedef HashTraits<Node*> NodeTraits;
68 typedef ListHashSetNodeHashFunctions<HashArg> NodeHash; 69 typedef ListHashSetNodeHashFunctions<HashArg> NodeHash;
69 typedef ListHashSetTranslator<HashArg> BaseTranslator; 70 typedef ListHashSetTranslator<HashArg> BaseTranslator;
70 71
71 typedef HashTable<Node*, Node*, IdentityExtractor, NodeHash, NodeTraits, NodeTraits, typename Allocator::TableAllocator> ImplType; 72 typedef HashTable<Node*, Node*, IdentityExtractor, NodeHash, NodeTraits, NodeTraits, typename Allocator::TableAllocator> ImplType;
72 typedef HashTableIterator<Node*, Node*, IdentityExtractor, NodeHash, Nod eTraits, NodeTraits, typename Allocator::TableAllocator> ImplTypeIterator; 73 typedef HashTableIterator<Node*, Node*, IdentityExtractor, NodeHash, Nod eTraits, NodeTraits, typename Allocator::TableAllocator> ImplTypeIterator;
(...skipping 18 matching lines...) Expand all
91 template<typename ValueType> struct HashTableAddResult { 92 template<typename ValueType> struct HashTableAddResult {
92 HashTableAddResult(Node* storedValue, bool isNewEntry) : storedValue(sto redValue), isNewEntry(isNewEntry) { } 93 HashTableAddResult(Node* storedValue, bool isNewEntry) : storedValue(sto redValue), isNewEntry(isNewEntry) { }
93 Node* storedValue; 94 Node* storedValue;
94 bool isNewEntry; 95 bool isNewEntry;
95 }; 96 };
96 typedef HashTableAddResult<ValueType> AddResult; 97 typedef HashTableAddResult<ValueType> AddResult;
97 98
98 ListHashSet(); 99 ListHashSet();
99 ListHashSet(const ListHashSet&); 100 ListHashSet(const ListHashSet&);
100 ListHashSet& operator=(const ListHashSet&); 101 ListHashSet& operator=(const ListHashSet&);
101 ~ListHashSet(); 102 void finalize();
102 103
103 void swap(ListHashSet&); 104 void swap(ListHashSet&);
104 105
105 unsigned size() const { return m_impl.size(); } 106 unsigned size() const { return m_impl.size(); }
106 unsigned capacity() const { return m_impl.capacity(); } 107 unsigned capacity() const { return m_impl.capacity(); }
107 bool isEmpty() const { return m_impl.isEmpty(); } 108 bool isEmpty() const { return m_impl.isEmpty(); }
108 109
109 iterator begin() { return makeIterator(m_head); } 110 iterator begin() { return makeIterator(m_head); }
110 iterator end() { return makeIterator(0); } 111 iterator end() { return makeIterator(0); }
111 const_iterator begin() const { return makeConstIterator(m_head); } 112 const_iterator begin() const { return makeConstIterator(m_head); }
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 template<typename T, size_t inlineCapacity, typename U, typename V> 667 template<typename T, size_t inlineCapacity, typename U, typename V>
667 inline void ListHashSet<T, inlineCapacity, U, V>::swap(ListHashSet& other) 668 inline void ListHashSet<T, inlineCapacity, U, V>::swap(ListHashSet& other)
668 { 669 {
669 m_impl.swap(other.m_impl); 670 m_impl.swap(other.m_impl);
670 std::swap(m_head, other.m_head); 671 std::swap(m_head, other.m_head);
671 std::swap(m_tail, other.m_tail); 672 std::swap(m_tail, other.m_tail);
672 m_allocatorProvider.swap(other.m_allocatorProvider); 673 m_allocatorProvider.swap(other.m_allocatorProvider);
673 } 674 }
674 675
675 template<typename T, size_t inlineCapacity, typename U, typename V> 676 template<typename T, size_t inlineCapacity, typename U, typename V>
676 inline ListHashSet<T, inlineCapacity, U, V>::~ListHashSet() 677 inline void ListHashSet<T, inlineCapacity, U, V>::finalize()
677 { 678 {
678 if (!Allocator::isGarbageCollected) 679 ASSERT(!Allocator::isGarbageCollected);
Mikhail 2014/05/09 08:06:36 think now it can be COMPILE_ASSERT
zerny-chromium 2014/05/09 09:19:48 Done.
679 deleteAllNodes(); 680 deleteAllNodes();
680 } 681 }
681 682
682 template<typename T, size_t inlineCapacity, typename U, typename V> 683 template<typename T, size_t inlineCapacity, typename U, typename V>
683 inline T& ListHashSet<T, inlineCapacity, U, V>::first() 684 inline T& ListHashSet<T, inlineCapacity, U, V>::first()
684 { 685 {
685 ASSERT(!isEmpty()); 686 ASSERT(!isEmpty());
686 return m_head->m_value; 687 return m_head->m_value;
687 } 688 }
688 689
689 template<typename T, size_t inlineCapacity, typename U, typename V> 690 template<typename T, size_t inlineCapacity, typename U, typename V>
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 inline void deleteAllValues(const ListHashSet<T, inlineCapacity, U, V>& coll ection) 973 inline void deleteAllValues(const ListHashSet<T, inlineCapacity, U, V>& coll ection)
973 { 974 {
974 deleteAllValues<true, typename ListHashSet<T, inlineCapacity, U, V>::Val ueType>(collection.m_impl); 975 deleteAllValues<true, typename ListHashSet<T, inlineCapacity, U, V>::Val ueType>(collection.m_impl);
975 } 976 }
976 977
977 } // namespace WTF 978 } // namespace WTF
978 979
979 using WTF::ListHashSet; 980 using WTF::ListHashSet;
980 981
981 #endif /* WTF_ListHashSet_h */ 982 #endif /* WTF_ListHashSet_h */
OLDNEW
« no previous file with comments | « Source/wtf/LinkedHashSet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698