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

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

Issue 1909353003: Allow passing WeakPtr across threads without AllowCrossThreadAccess() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Kuroneko_4a_ACTA_ThreadSafeRefCounted
Patch Set: Rebase, Add CrossThreadCopier for WeakPTr Created 4 years, 7 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 | « third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 aa1aa85d157439d9cc22684a2556df881d05ee72..a3fce4a8e779dd938613b67bb69382d93539edba 100644
--- a/third_party/WebKit/Source/platform/CrossThreadCopier.h
+++ b/third_party/WebKit/Source/platform/CrossThreadCopier.h
@@ -159,6 +159,11 @@ struct CrossThreadCopier<CrossThreadPersistent<T>> : public CrossThreadCopierPas
STATIC_ONLY(CrossThreadCopier);
};
+template<typename T>
+struct CrossThreadCopier<WeakPtr<T>> : public CrossThreadCopierPassThrough<WeakPtr<T>> {
+ STATIC_ONLY(CrossThreadCopier);
+};
+
template <typename T>
struct CrossThreadCopier<WTF::PassedWrapper<T>> {
STATIC_ONLY(CrossThreadCopier);
@@ -217,19 +222,17 @@ struct CrossThreadCopier<Member<T>> {
}
};
-// |T| is |C*| or |const WeakPtr<C>&|.
+// |T| is a pointer type.
template <typename T>
struct AllowCrossThreadAccessWrapper {
STACK_ALLOCATED();
public:
T value() const { return m_value; }
private:
- // Only constructible from AllowCrossThreadAccess().
+ // Only constructible from AllowCrossThreadAccess*().
explicit AllowCrossThreadAccessWrapper(T value) : m_value(value) { }
template <typename U>
friend AllowCrossThreadAccessWrapper<U*> AllowCrossThreadAccess(U*);
- template <typename U>
- friend AllowCrossThreadAccessWrapper<const WeakPtr<U>&> AllowCrossThreadAccess(const WeakPtr<U>&);
// This raw pointer is safe since AllowCrossThreadAccessWrapper is
// always stack-allocated. Ideally this should be Member<T> if T is
@@ -255,12 +258,6 @@ AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value)
return AllowCrossThreadAccessWrapper<T*>(value);
}
-template <typename T>
-AllowCrossThreadAccessWrapper<const WeakPtr<T>&> AllowCrossThreadAccess(const WeakPtr<T>& value)
-{
- return AllowCrossThreadAccessWrapper<const WeakPtr<T>&>(value);
-}
-
} // namespace blink
#endif // CrossThreadCopier_h
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698