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> { |
}; |