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

Unified Diff: third_party/WebKit/Source/wtf/RefPtr.h

Issue 2125003002: Move CrossThreadCopier from platform/ to wtf/ Base URL: https://chromium.googlesource.com/chromium/src.git@TRV_RemoveTupleInBind
Patch Set: Rebase Created 4 years, 5 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/wtf/RefPtr.h
diff --git a/third_party/WebKit/Source/wtf/RefPtr.h b/third_party/WebKit/Source/wtf/RefPtr.h
index 0097b914fe56229596f906da298c79dc80788251..412ec96b97ef01c30c2d63b4206d72e9c5ec935b 100644
--- a/third_party/WebKit/Source/wtf/RefPtr.h
+++ b/third_party/WebKit/Source/wtf/RefPtr.h
@@ -24,11 +24,16 @@
#define WTF_RefPtr_h
#include "wtf/Allocator.h"
+#include "wtf/CrossThreadCopier.h"
#include "wtf/HashTableDeletedValueType.h"
#include "wtf/PassRefPtr.h"
+#include "wtf/ThreadSafeRefCounted.h"
+#include "wtf/TypeTraits.h"
#include <algorithm>
#include <utility>
+class SkRefCnt;
+
namespace WTF {
template <typename T> class PassRefPtr;
@@ -86,6 +91,12 @@ private:
};
template <typename T>
+struct CrossThreadCopier<RefPtr<T>> : public CrossThreadCopierPassThrough<RefPtr<T>> {
+ STATIC_ONLY(CrossThreadCopier);
+ static_assert(IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value || std::is_base_of<SkRefCnt, T>::value, "RefPtr<T> can be passed across threads only if T is ThreadSafeRefCounted or SkRefCnt.");
+};
+
+template <typename T>
template <typename U> inline RefPtr<T>::RefPtr(const PassRefPtr<U>& o, EnsurePtrConvertibleArgDefn(U, T))
: m_ptr(o.leakRef())
{

Powered by Google App Engine
This is Rietveld 408576698