Index: Source/platform/heap/Handle.h |
diff --git a/Source/platform/heap/Handle.h b/Source/platform/heap/Handle.h |
index 203780194d341006cc438cfc192b83c1c6030215..0691d160157e7a29158334039ee96c806e7d8ce4 100644 |
--- a/Source/platform/heap/Handle.h |
+++ b/Source/platform/heap/Handle.h |
@@ -34,6 +34,7 @@ |
#include "platform/heap/Heap.h" |
#include "platform/heap/ThreadState.h" |
#include "platform/heap/Visitor.h" |
+#include "wtf/Functional.h" |
#include "wtf/HashFunctions.h" |
#include "wtf/Locker.h" |
#include "wtf/RawPtr.h" |
@@ -1152,6 +1153,36 @@ struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli |
static const bool value = true; |
}; |
+// For wtf/Functional.h |
+template<typename T, bool isGC> struct PointerParamStorageTraits; |
haraken
2014/06/06 05:54:53
Nit: isGC => isGarbageCollected
tkent
2014/06/06 06:52:48
Done.
|
+ |
+template<typename T> struct PointerParamStorageTraits<T*, false> { |
+ typedef T* StorageType; |
+ |
+ static StorageType wrap(T* value) { return value; } |
+ static T* unwrap(const StorageType& value) { return value; } |
+}; |
+ |
+template<typename T> struct PointerParamStorageTraits<T*, true> { |
+ typedef WebCore::CrossThreadPersistent<T> StorageType; |
+ |
+ static StorageType wrap(T* value) { return value; } |
+ static T* unwrap(const StorageType& value) { return value.get(); } |
+}; |
+ |
+// FIXME: This doesn't support collections and const types. See |
+// COMPILE_ASSERT_IS_GARBAGE_COLLECTED. |
+template<typename T> struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, WTF::IsSubclassOfTemplate<T, WebCore::GarbageCollected>::value || WebCore::IsGarbageCollectedMixin<T>::value> { |
+}; |
+ |
+// We assume RawPtr<T> is used only for garbage-collected types. |
+template<typename T> struct ParamStorageTraits<RawPtr<T> > { |
+ typedef WebCore::CrossThreadPersistent<T> StorageType; |
+ |
+ static StorageType wrap(RawPtr<T> value) { return value.get(); } |
+ static T* unwrap(const StorageType& value) { return value.get(); } |
+}; |
+ |
} // namespace WTF |
#endif |