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 23 matching lines...) Expand all Loading... |
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/RawPtr.h" |
41 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
42 #include "wtf/ThreadSafeRefCounted.h" | 42 #include "wtf/ThreadSafeRefCounted.h" |
43 #include "wtf/TypeTraits.h" | 43 #include "wtf/TypeTraits.h" |
| 44 #include "wtf/UnretainedPtr.h" |
44 | 45 |
45 namespace blink { | 46 namespace blink { |
46 | 47 |
47 class IntRect; | 48 class IntRect; |
48 class IntSize; | 49 class IntSize; |
49 class KURL; | 50 class KURL; |
50 class ResourceError; | 51 class ResourceError; |
51 class ResourceRequest; | 52 class ResourceRequest; |
52 class ResourceResponse; | 53 class ResourceResponse; |
53 struct CrossThreadResourceResponseData; | 54 struct CrossThreadResourceResponseData; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 }; | 146 }; |
146 | 147 |
147 template<typename T> struct CrossThreadCopierBase<false, false, true, RawPtr
<T> > { | 148 template<typename T> struct CrossThreadCopierBase<false, false, true, RawPtr
<T> > { |
148 typedef RawPtr<T> Type; | 149 typedef RawPtr<T> Type; |
149 static Type copy(const Type& ptr) | 150 static Type copy(const Type& ptr) |
150 { | 151 { |
151 return ptr; | 152 return ptr; |
152 } | 153 } |
153 }; | 154 }; |
154 | 155 |
| 156 template<typename T> struct CrossThreadCopierBase<false, false, true, Unreta
inedPtr<T> > { |
| 157 typedef RawPtr<T> Type; |
| 158 static Type copy(const Type& ptr) |
| 159 { |
| 160 return ptr; |
| 161 } |
| 162 }; |
| 163 |
155 template<typename T> struct CrossThreadCopierBase<false, false, true, Member
<T> > { | 164 template<typename T> struct CrossThreadCopierBase<false, false, true, Member
<T> > { |
156 typedef RawPtr<T> Type; | 165 typedef RawPtr<T> Type; |
157 static Type copy(const Member<T>& ptr) | 166 static Type copy(const Member<T>& ptr) |
158 { | 167 { |
159 return ptr; | 168 return ptr; |
160 } | 169 } |
161 }; | 170 }; |
162 | 171 |
163 template<typename T> struct CrossThreadCopierBase<false, false, true, WeakMe
mber<T> > { | 172 template<typename T> struct CrossThreadCopierBase<false, false, true, WeakMe
mber<T> > { |
164 typedef RawPtr<T> Type; | 173 typedef RawPtr<T> Type; |
165 static Type copy(const WeakMember<T>& ptr) | 174 static Type copy(const WeakMember<T>& ptr) |
166 { | 175 { |
167 return ptr; | 176 return ptr; |
168 } | 177 } |
169 }; | 178 }; |
170 | 179 |
171 template<typename T> struct CrossThreadCopier : public CrossThreadCopierBase
<WTF::IsConvertibleToInteger<T>::value, | 180 template<typename T> struct CrossThreadCopier : public CrossThreadCopierBase
<WTF::IsConvertibleToInteger<T>::value, |
172 WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, RefPtr>::Type,
ThreadSafeRefCounted>::value | 181 WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, RefPtr>::Type,
ThreadSafeRefCounted>::value |
173 || WTF::IsSubclassOfTemplate<typename WTF::RemovePointer<T>::Type, T
hreadSafeRefCounted>::value | 182 || WTF::IsSubclassOfTemplate<typename WTF::RemovePointer<T>::Type, T
hreadSafeRefCounted>::value |
174 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, PassRef
Ptr>::Type, ThreadSafeRefCounted>::value, | 183 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, PassRef
Ptr>::Type, ThreadSafeRefCounted>::value, |
175 WTF::IsSubclassOfTemplate<typename WTF::RemovePointer<T>::Type, GarbageC
ollected>::value | 184 WTF::IsSubclassOfTemplate<typename WTF::RemovePointer<T>::Type, GarbageC
ollected>::value |
176 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, RawPtr>
::Type, GarbageCollected>::value | 185 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, RawPtr>
::Type, GarbageCollected>::value |
| 186 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, Unretai
nedPtr>::Type, GarbageCollected>::value |
177 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, Member>
::Type, GarbageCollected>::value | 187 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, Member>
::Type, GarbageCollected>::value |
178 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, WeakMem
ber>::Type, GarbageCollected>::value, | 188 || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, WeakMem
ber>::Type, GarbageCollected>::value, |
179 T> { | 189 T> { |
180 }; | 190 }; |
181 | 191 |
182 template<typename T> struct AllowCrossThreadAccessWrapper { | 192 template<typename T> struct AllowCrossThreadAccessWrapper { |
183 STACK_ALLOCATED(); | 193 STACK_ALLOCATED(); |
184 public: | 194 public: |
185 explicit AllowCrossThreadAccessWrapper(T* value) : m_value(value) { } | 195 explicit AllowCrossThreadAccessWrapper(T* value) : m_value(value) { } |
186 T* value() const { return m_value; } | 196 T* value() const { return m_value; } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 237 |
228 template<typename T> AllowAccessLaterWrapper<T> AllowAccessLater(T* value) | 238 template<typename T> AllowAccessLaterWrapper<T> AllowAccessLater(T* value) |
229 { | 239 { |
230 return AllowAccessLaterWrapper<T>(value); | 240 return AllowAccessLaterWrapper<T>(value); |
231 } | 241 } |
232 | 242 |
233 | 243 |
234 } // namespace blink | 244 } // namespace blink |
235 | 245 |
236 #endif // CrossThreadCopier_h | 246 #endif // CrossThreadCopier_h |
OLD | NEW |