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

Unified Diff: Source/heap/Visitor.h

Issue 223373002: Create HeapLinkedHashSet and LinkedHashSet, ordered heap-friendly hash sets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove inadvertent changes Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: Source/heap/Visitor.h
diff --git a/Source/heap/Visitor.h b/Source/heap/Visitor.h
index 4d52a0368166e6915a8deb84de796f9f2ac4132d..92f92de30d8dfb15c89773dc268ad408039d56d8 100644
--- a/Source/heap/Visitor.h
+++ b/Source/heap/Visitor.h
@@ -39,6 +39,7 @@
#include "wtf/HashMap.h"
#include "wtf/HashSet.h"
#include "wtf/HashTraits.h"
+#include "wtf/LinkedHashSet.h"
#include "wtf/ListHashSet.h"
#include "wtf/OwnPtr.h"
#include "wtf/RefPtr.h"
@@ -262,6 +263,12 @@ public:
OffHeapCollectionTraceTrait<ListHashSet<T, inlineCapacity, U> >::trace(this, hashSet);
}
+ template<typename T, typename U>
+ void trace(const LinkedHashSet<T, U>& hashSet)
+ {
+ OffHeapCollectionTraceTrait<LinkedHashSet<T, U> >::trace(this, hashSet);
+ }
+
template<typename T, size_t N>
void trace(const Deque<T, N>& deque)
{
@@ -427,6 +434,20 @@ struct OffHeapCollectionTraceTrait<WTF::ListHashSet<T, inlineCapacity, HashFunct
}
};
+template<typename T, typename HashFunctions>
+struct OffHeapCollectionTraceTrait<WTF::LinkedHashSet<T, HashFunctions> > {
+ typedef WTF::LinkedHashSet<T, HashFunctions> LinkedHashSet;
+
+ static void trace(Visitor* visitor, const LinkedHashSet& set)
+ {
+ if (set.isEmpty())
+ return;
+ LinkedHashSet& iterSet = const_cast<LinkedHashSet&>(set);
+ for (typename LinkedHashSet::iterator it = iterSet.begin(), end = iterSet.end(); it != end; ++it)
+ visitor->trace(*it);
+ }
+};
+
template<typename Key, typename Value, typename HashFunctions, typename KeyTraits, typename ValueTraits>
struct OffHeapCollectionTraceTrait<WTF::HashMap<Key, Value, HashFunctions, KeyTraits, ValueTraits, WTF::DefaultAllocator> > {
typedef WTF::HashMap<Key, Value, HashFunctions, KeyTraits, ValueTraits, WTF::DefaultAllocator> HashMap;

Powered by Google App Engine
This is Rietveld 408576698