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

Unified Diff: Source/WebCore/platform/CrossThreadCopier.h

Issue 7946013: Merge 94986 - Make the ThreadSafeRefCounted support in CrossThreadCopier work for T*. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 3 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 | Source/WebCore/platform/CrossThreadCopier.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/CrossThreadCopier.h
===================================================================
--- Source/WebCore/platform/CrossThreadCopier.h (revision 95461)
+++ Source/WebCore/platform/CrossThreadCopier.h (working copy)
@@ -31,6 +31,7 @@
#ifndef CrossThreadCopier_h
#define CrossThreadCopier_h
+#include <wtf/Assertions.h>
#include <wtf/Forward.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
@@ -68,11 +69,19 @@
// Custom copy methods.
template<typename T> struct CrossThreadCopierBase<false, true, T> {
typedef typename WTF::RemoveTemplate<T, RefPtr>::Type TypeWithoutRefPtr;
- typedef typename WTF::RemoveTemplate<TypeWithoutRefPtr, PassRefPtr>::Type RefCountedType;
+ typedef typename WTF::RemoveTemplate<TypeWithoutRefPtr, PassRefPtr>::Type TypeWithoutPassRefPtr;
+ typedef typename WTF::RemovePointer<TypeWithoutPassRefPtr>::Type RefCountedType;
+
+ // Verify that only one of the above did a change.
+ COMPILE_ASSERT((WTF::IsSameType<RefPtr<RefCountedType>, T>::value
+ || WTF::IsSameType<PassRefPtr<RefCountedType>, T>::value
+ || WTF::IsSameType<RefCountedType*, T>::value),
+ OnlyAllowOneTypeModification);
+
typedef PassRefPtr<RefCountedType> Type;
static Type copy(const T& refPtr)
{
- return refPtr.get();
+ return refPtr;
}
};
@@ -111,6 +120,7 @@
template<typename T> struct CrossThreadCopier : public CrossThreadCopierBase<WTF::IsConvertibleToInteger<T>::value,
WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, RefPtr>::Type, ThreadSafeRefCounted>::value
+ || WTF::IsSubclassOfTemplate<typename WTF::RemovePointer<T>::Type, ThreadSafeRefCounted>::value
|| WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, PassRefPtr>::Type, ThreadSafeRefCounted>::value,
T> {
};
« no previous file with comments | « no previous file | Source/WebCore/platform/CrossThreadCopier.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698