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

Unified Diff: third_party/WebKit/Source/platform/CrossThreadCopier.h

Issue 1925583003: Replace AllowCrossThreadAccess() + non-GCed pointers with crossThreadUnretained() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Kuroneko_4
Patch Set: Rebase. Created 4 years, 6 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
Index: third_party/WebKit/Source/platform/CrossThreadCopier.h
diff --git a/third_party/WebKit/Source/platform/CrossThreadCopier.h b/third_party/WebKit/Source/platform/CrossThreadCopier.h
index cfb46fa77cd6ab229719410cd9b0f1f223dc198a..82e46f0bb740a5dd135f537c042958bf5879123b 100644
--- a/third_party/WebKit/Source/platform/CrossThreadCopier.h
+++ b/third_party/WebKit/Source/platform/CrossThreadCopier.h
@@ -155,6 +155,11 @@ struct CrossThreadCopier<CrossThreadWeakPersistent<T>> : public CrossThreadCopie
};
template<typename T>
+struct CrossThreadCopier<WTF::UnretainedWrapper<T, WTF::CrossThreadAffinity>> : public CrossThreadCopierPassThrough<WTF::UnretainedWrapper<T, WTF::CrossThreadAffinity>> {
+ STATIC_ONLY(CrossThreadCopier);
+};
+
+template<typename T>
struct CrossThreadCopier<WeakPtr<T>> : public CrossThreadCopierPassThrough<WeakPtr<T>> {
STATIC_ONLY(CrossThreadCopier);
};
@@ -217,42 +222,6 @@ struct CrossThreadCopier<Member<T>> {
}
};
-// |T| is a pointer type.
-template <typename T>
-struct AllowCrossThreadAccessWrapper {
- STACK_ALLOCATED();
-public:
- T value() const { return m_value; }
-private:
- // Only constructible from AllowCrossThreadAccess*().
- explicit AllowCrossThreadAccessWrapper(T value) : m_value(value) { }
- template <typename U>
- friend AllowCrossThreadAccessWrapper<U*> AllowCrossThreadAccess(U*);
-
- // This raw pointer is safe since AllowCrossThreadAccessWrapper is
- // always stack-allocated. Ideally this should be Member<T> if T is
- // garbage-collected and T* otherwise, but we don't want to introduce
- // another template magic just for distinguishing Member<T> from T*.
- // From the perspective of GC, T* always works correctly.
- GC_PLUGIN_IGNORE("")
- T m_value;
-};
-
-template <typename T>
-struct CrossThreadCopier<AllowCrossThreadAccessWrapper<T>> {
- STATIC_ONLY(CrossThreadCopier);
- typedef T Type;
- static Type copy(const AllowCrossThreadAccessWrapper<T>& wrapper) { return wrapper.value(); }
-};
-
-template <typename T>
-AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value)
-{
- static_assert(!IsGarbageCollectedType<T>::value, "Use wrapCrossThreadPersistent() instead for garbage-collected pointers");
- static_assert(!WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "Use PassRefPtr<T> instead for ThreadSafeRefCounted");
- return AllowCrossThreadAccessWrapper<T*>(value);
-}
-
} // namespace blink
#endif // CrossThreadCopier_h

Powered by Google App Engine
This is Rietveld 408576698