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

Unified Diff: Source/wtf/Vector.h

Issue 827723002: Reland: Templatize visitor arguments for TraceTrait mark and trace methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 5 years, 11 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/wtf/TypeTraits.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/Vector.h
diff --git a/Source/wtf/Vector.h b/Source/wtf/Vector.h
index 50e924d617283b71049a3e538872d106314e1f79..982c68912b935dbb594515eb43e6e10c12953a36 100644
--- a/Source/wtf/Vector.h
+++ b/Source/wtf/Vector.h
@@ -745,7 +745,7 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE;
void reverse();
- void trace(typename Allocator::Visitor*);
+ template<typename VisitorDispatcher> void trace(VisitorDispatcher);
private:
void expandCapacity(size_t newMinCapacity);
@@ -1210,14 +1210,15 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE;
// This is only called if the allocator is a HeapAllocator. It is used when
// visiting during a tracing GC.
template<typename T, size_t inlineCapacity, typename Allocator>
- void Vector<T, inlineCapacity, Allocator>::trace(typename Allocator::Visitor* visitor)
+ template<typename VisitorDispatcher>
+ void Vector<T, inlineCapacity, Allocator>::trace(VisitorDispatcher visitor)
{
ASSERT(Allocator::isGarbageCollected); // Garbage collector must be enabled.
const T* bufferBegin = buffer();
const T* bufferEnd = buffer() + size();
if (ShouldBeTraced<VectorTraits<T> >::value) {
for (const T* bufferEntry = bufferBegin; bufferEntry != bufferEnd; bufferEntry++)
- Allocator::template trace<T, VectorTraits<T> >(visitor, *const_cast<T*>(bufferEntry));
+ Allocator::template trace<VisitorDispatcher, T, VectorTraits<T> >(visitor, *const_cast<T*>(bufferEntry));
}
if (this->hasOutOfLineBuffer())
Allocator::markNoTracing(visitor, buffer());
« no previous file with comments | « Source/wtf/TypeTraits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698