Index: Source/platform/heap/Handle.h |
diff --git a/Source/platform/heap/Handle.h b/Source/platform/heap/Handle.h |
index 918a73135e39b7dbef858ae868b5a00a404fe9a0..2ed21661f17d2269c56f64b6adc1d69f35509e28 100644 |
--- a/Source/platform/heap/Handle.h |
+++ b/Source/platform/heap/Handle.h |
@@ -676,22 +676,29 @@ public: |
} |
}; |
-template<bool needsTracing, typename T> |
-struct StdPairHelper; |
+template<typename T, bool needsTracing> |
+struct TraceIfEnabled; |
template<typename T> |
-struct StdPairHelper<false, T> { |
+struct TraceIfEnabled<T, false> { |
static void trace(Visitor*, T*) { } |
}; |
template<typename T> |
-struct StdPairHelper<true, T> { |
+struct TraceIfEnabled<T, true> { |
static void trace(Visitor* visitor, T* t) |
{ |
visitor->trace(*t); |
} |
}; |
+template <typename T> struct RemoveHeapPointerWrapperTypes { |
+ typedef typename WTF::RemoveTemplate<typename WTF::RemoveTemplate<typename WTF::RemoveTemplate<T, Member>::Type, WeakMember>::Type, RawPtr>::Type Type; |
+}; |
+ |
+template<typename T> |
+struct TraceIfNeeded : public TraceIfEnabled<T, WebCore::IsGarbageCollectedType<typename RemoveHeapPointerWrapperTypes<typename WTF::RemovePointer<T>::Type>::Type>::value> { }; |
zerny-chromium
2014/08/01 08:05:15
I don't think this trait does what we would like i
|
+ |
// This trace trait for std::pair will null weak members if their referent is |
// collected. If you have a collection that contain weakness it does not remove |
// entries from the collection that contain nulled weak members. |
@@ -702,8 +709,8 @@ public: |
static const bool secondNeedsTracing = WTF::NeedsTracing<U>::value || WTF::IsWeak<U>::value; |
static void trace(Visitor* visitor, std::pair<T, U>* pair) |
{ |
- StdPairHelper<firstNeedsTracing, T>::trace(visitor, &pair->first); |
- StdPairHelper<secondNeedsTracing, U>::trace(visitor, &pair->second); |
+ TraceIfEnabled<T, firstNeedsTracing>::trace(visitor, &pair->first); |
+ TraceIfEnabled<U, secondNeedsTracing>::trace(visitor, &pair->second); |
} |
}; |