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

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

Issue 1916923005: Disallow direct use of AllowCrossThreadAccessWrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Kuroneko_prep0
Patch Set: auto-Rebase Created 4 years, 8 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 | « no previous file | third_party/WebKit/Source/platform/heap/HeapTest.cpp » ('j') | 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 de30baa00edcbd544efed937b4cce778f137a8a7..520a8e9fdb8fdc9b3b5b5b98ae8b2a6f18a8bae0 100644
--- a/third_party/WebKit/Source/platform/CrossThreadCopier.h
+++ b/third_party/WebKit/Source/platform/CrossThreadCopier.h
@@ -241,9 +241,15 @@ template <typename T>
struct AllowCrossThreadAccessWrapper {
STACK_ALLOCATED();
public:
- explicit AllowCrossThreadAccessWrapper(T value) : m_value(value) { }
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*);
+ 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
// garbage-collected and T* otherwise, but we don't want to introduce
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/HeapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698