| Index: Source/platform/heap/Handle.h
|
| diff --git a/Source/platform/heap/Handle.h b/Source/platform/heap/Handle.h
|
| index 39046ada559b1e6a46e7c7d15ea4baa19a7743dc..9a2b182c15acd852b73c01cfc133349000fc5408 100644
|
| --- a/Source/platform/heap/Handle.h
|
| +++ b/Source/platform/heap/Handle.h
|
| @@ -991,6 +991,16 @@ private:
|
| OwnPtr<Persistent<Self>> m_keepAlive;
|
| };
|
|
|
| +template<typename T>
|
| +class AllowCrossThreadWeakPersistent {
|
| + STACK_ALLOCATED();
|
| +public:
|
| + explicit AllowCrossThreadWeakPersistent(T* value) : m_value(value) { }
|
| + CrossThreadWeakPersistent<T> value() const { return m_value; }
|
| +private:
|
| + CrossThreadWeakPersistent<T> m_value;
|
| +};
|
| +
|
| } // namespace blink
|
|
|
| namespace WTF {
|
| @@ -1182,6 +1192,18 @@ struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
|
| };
|
|
|
| template<typename T>
|
| +struct ParamStorageTraits<blink::AllowCrossThreadWeakPersistent<T>> {
|
| + static_assert(sizeof(T), "T must be fully defined");
|
| + using StorageType = blink::CrossThreadWeakPersistent<T>;
|
| +
|
| + static StorageType wrap(const blink::AllowCrossThreadWeakPersistent<T>& value) { return value.value(); }
|
| +
|
| + // Currently assume that the call sites of this unwrap() account for cleared weak references also.
|
| + // TODO(sof): extend WTF::FunctionWrapper call overloading to also handle (CrossThread)WeakPersistent.
|
| + static T* unwrap(const StorageType& value) { return value.get(); }
|
| +};
|
| +
|
| +template<typename T>
|
| PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete;
|
|
|
| } // namespace WTF
|
|
|