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

Unified Diff: Source/platform/heap/Visitor.h

Issue 260713004: Add HeapHashCountedSet (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nit 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/wtf/HashCountedSet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Visitor.h
diff --git a/Source/platform/heap/Visitor.h b/Source/platform/heap/Visitor.h
index 4e809d5df3e9175d6432ad177c2b4100349d3563..b59050b4efb89e90a537ea805c2189800809d303 100644
--- a/Source/platform/heap/Visitor.h
+++ b/Source/platform/heap/Visitor.h
@@ -36,6 +36,7 @@
#include "wtf/Assertions.h"
#include "wtf/Deque.h"
#include "wtf/Forward.h"
+#include "wtf/HashCountedSet.h"
#include "wtf/HashMap.h"
#include "wtf/HashSet.h"
#include "wtf/HashTraits.h"
@@ -298,6 +299,12 @@ public:
OffHeapCollectionTraceTrait<Deque<T, N> >::trace(this, deque);
}
+ template<typename T, typename U, typename V>
+ void trace(const HashCountedSet<T, U, V>& set)
+ {
+ OffHeapCollectionTraceTrait<HashCountedSet<T, U, V> >::trace(this, set);
+ }
+
template<typename T, typename U, typename V, typename W, typename X>
void trace(const HashMap<T, U, V, W, X, WTF::DefaultAllocator>& map)
{
@@ -546,6 +553,19 @@ struct OffHeapCollectionTraceTrait<WTF::Deque<T, N> > {
}
};
+template<typename T, typename U, typename V>
+struct OffHeapCollectionTraceTrait<WTF::HashCountedSet<T, U, V> > {
+ typedef WTF::HashCountedSet<T, U, V> Set;
+
+ static void trace(Visitor* visitor, const Set& set)
+ {
+ if (set.isEmpty())
+ return;
+ for (typename Set::const_iterator it = set.begin(), end = set.end(); it != end; ++it)
+ TraceTrait<T>::trace(visitor, const_cast<T*>(&(it->key)));
+ }
+};
+
template<typename T, typename Traits = WTF::VectorTraits<T> >
class HeapVectorBacking;
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/wtf/HashCountedSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698