OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 19 matching lines...) Expand all Loading... | |
30 | 30 |
31 #ifndef CrossThreadCopier_h | 31 #ifndef CrossThreadCopier_h |
32 #define CrossThreadCopier_h | 32 #define CrossThreadCopier_h |
33 | 33 |
34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
35 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
36 #include "wtf/Assertions.h" | 36 #include "wtf/Assertions.h" |
37 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
39 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
40 #include "wtf/RawPtr.h" | |
40 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
41 #include "wtf/ThreadSafeRefCounted.h" | 42 #include "wtf/ThreadSafeRefCounted.h" |
42 #include "wtf/TypeTraits.h" | 43 #include "wtf/TypeTraits.h" |
43 | 44 |
44 namespace WebCore { | 45 namespace WebCore { |
45 | 46 |
46 class IntRect; | 47 class IntRect; |
47 class IntSize; | 48 class IntSize; |
48 class KURL; | 49 class KURL; |
49 class ResourceError; | 50 class ResourceError; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 | 145 |
145 template<typename T> struct CrossThreadCopierBase<false, false, true, T> { | 146 template<typename T> struct CrossThreadCopierBase<false, false, true, T> { |
146 typedef typename WTF::RemovePointer<T>::Type TypeWithoutPointer; | 147 typedef typename WTF::RemovePointer<T>::Type TypeWithoutPointer; |
147 typedef RawPtr<TypeWithoutPointer> Type; | 148 typedef RawPtr<TypeWithoutPointer> Type; |
148 static Type copy(const T& ptr) | 149 static Type copy(const T& ptr) |
149 { | 150 { |
150 return ptr; | 151 return ptr; |
151 } | 152 } |
152 }; | 153 }; |
153 | 154 |
155 template<typename T> struct CrossThreadCopierBase<false, false, true, RawPtr <T> > { | |
156 typedef RawPtr<T> Type; | |
157 static Type copy(const Type& ptr) | |
158 { | |
159 return ptr; | |
160 } | |
161 }; | |
162 | |
163 template<typename T> struct CrossThreadCopierBase<false, false, true, WeakMe mber<T> > { | |
164 typedef RawPtr<T> Type; | |
165 static Type copy(const WeakMember<T>& ptr) | |
166 { | |
167 return ptr.get(); | |
haraken
2014/07/10 12:01:45
Do you need get()?
sof
2014/07/10 12:05:03
Conversions will take care of it; I just wanted to
| |
168 } | |
169 }; | |
170 | |
171 template<typename T> struct CrossThreadCopierBase<false, false, true, Member <T> > { | |
172 typedef RawPtr<T> Type; | |
173 static Type copy(const Member<T>& ptr) | |
174 { | |
175 return ptr.get(); | |
haraken
2014/07/10 12:01:45
Ditto.
| |
176 } | |
177 }; | |
178 | |
154 template<typename T> struct CrossThreadCopier : public CrossThreadCopierBase <WTF::IsConvertibleToInteger<T>::value, | 179 template<typename T> struct CrossThreadCopier : public CrossThreadCopierBase <WTF::IsConvertibleToInteger<T>::value, |
155 WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, RefPtr>::Type, ThreadSafeRefCounted>::value | 180 WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, RefPtr>::Type, ThreadSafeRefCounted>::value |
156 || WTF::IsSubclassOfTemplate<typename WTF::RemovePointer<T>::Type, T hreadSafeRefCounted>::value | 181 || WTF::IsSubclassOfTemplate<typename WTF::RemovePointer<T>::Type, T hreadSafeRefCounted>::value |
157 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, PassRef Ptr>::Type, ThreadSafeRefCounted>::value, | 182 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, PassRef Ptr>::Type, ThreadSafeRefCounted>::value, |
158 WTF::IsSubclassOfTemplate<typename WTF::RemovePointer<T>::Type, GarbageC ollected>::value, | 183 WTF::IsSubclassOfTemplate<typename WTF::RemovePointer<T>::Type, GarbageC ollected>::value |
184 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, RawPtr> ::Type, GarbageCollected>::value | |
185 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, Member> ::Type, GarbageCollected>::value | |
186 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, WeakMem ber>::Type, GarbageCollected>::value, | |
159 T> { | 187 T> { |
160 }; | 188 }; |
161 | 189 |
162 template<typename T> struct AllowCrossThreadAccessWrapper { | 190 template<typename T> struct AllowCrossThreadAccessWrapper { |
163 public: | 191 public: |
164 explicit AllowCrossThreadAccessWrapper(T* value) : m_value(value) { } | 192 explicit AllowCrossThreadAccessWrapper(T* value) : m_value(value) { } |
165 T* value() const { return m_value; } | 193 T* value() const { return m_value; } |
166 private: | 194 private: |
167 T* m_value; | 195 T* m_value; |
168 }; | 196 }; |
(...skipping 25 matching lines...) Expand all Loading... | |
194 | 222 |
195 template<typename T> AllowAccessLaterWrapper<T> AllowAccessLater(T* value) | 223 template<typename T> AllowAccessLaterWrapper<T> AllowAccessLater(T* value) |
196 { | 224 { |
197 return AllowAccessLaterWrapper<T>(value); | 225 return AllowAccessLaterWrapper<T>(value); |
198 } | 226 } |
199 | 227 |
200 | 228 |
201 } // namespace WebCore | 229 } // namespace WebCore |
202 | 230 |
203 #endif // CrossThreadCopier_h | 231 #endif // CrossThreadCopier_h |
OLD | NEW |