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

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

Issue 365653002: Oilpan: move 2D Canvas and WebGL objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Smaller adjustments Created 6 years, 5 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/core/html/canvas/WebGLVertexArrayObjectOES.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
};
« no previous file with comments | « Source/core/html/canvas/WebGLVertexArrayObjectOES.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698