Index: third_party/WebKit/Source/wtf/Functional.h |
diff --git a/third_party/WebKit/Source/wtf/Functional.h b/third_party/WebKit/Source/wtf/Functional.h |
index de82d7dc1d98b2315fdbce6b9530e62d9b89e719..694963ae2bbf6c31b8e9394669225d86d7af404f 100644 |
--- a/third_party/WebKit/Source/wtf/Functional.h |
+++ b/third_party/WebKit/Source/wtf/Functional.h |
@@ -34,10 +34,15 @@ |
#include "wtf/PtrUtil.h" |
#include "wtf/RefPtr.h" |
#include "wtf/ThreadSafeRefCounted.h" |
+#include "wtf/TypeTraits.h" |
#include "wtf/WeakPtr.h" |
#include <tuple> |
#include <utility> |
+namespace blink { |
+template<typename T> class CrossThreadPersistent; |
+} |
+ |
namespace WTF { |
// Functional.h provides a very simple way to bind a function pointer and arguments together into a function object |
@@ -232,6 +237,31 @@ struct ParamStorageTraits<PassedWrapper<T>> { |
static T unwrap(StorageType& value) { return value.moveOut(); } |
}; |
+template<typename T, bool isGarbageCollected> struct PointerParamStorageTraits; |
+ |
+template<typename T> |
+struct PointerParamStorageTraits<T*, false> { |
+ STATIC_ONLY(PointerParamStorageTraits); |
+ using StorageType = T*; |
+ |
+ static StorageType wrap(T* value) { return value; } |
+ static T* unwrap(const StorageType& value) { return value; } |
+}; |
+ |
+template<typename T> |
+struct PointerParamStorageTraits<T*, true> { |
+ STATIC_ONLY(PointerParamStorageTraits); |
+ using StorageType = blink::CrossThreadPersistent<T>; |
+ |
+ static StorageType wrap(T* value) { return value; } |
+ static T* unwrap(const StorageType& value) { return value.get(); } |
+}; |
+ |
+template<typename T> |
+struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, IsGarbageCollectedType<T>::value> { |
+ STATIC_ONLY(ParamStorageTraits); |
+}; |
+ |
enum FunctionThreadAffinity { |
CrossThreadAffinity, |
SameThreadAffinity |