| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 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/Persistent.h" |
| 35 #include "third_party/skia/include/core/SkRefCnt.h" | 36 #include "third_party/skia/include/core/SkRefCnt.h" |
| 36 #include "wtf/Assertions.h" | 37 #include "wtf/Assertions.h" |
| 37 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
| 38 #include "wtf/Functional.h" // FunctionThreadAffinity | 39 #include "wtf/Functional.h" // FunctionThreadAffinity |
| 39 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.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 #include "wtf/WeakPtr.h" | 44 #include "wtf/WeakPtr.h" |
| 44 #include <memory> | 45 #include <memory> |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 { | 138 { |
| 138 return pointer; // This is in fact a move. | 139 return pointer; // This is in fact a move. |
| 139 } | 140 } |
| 140 }; | 141 }; |
| 141 | 142 |
| 142 template<typename T> | 143 template<typename T> |
| 143 struct CrossThreadCopier<CrossThreadPersistent<T>> : public CrossThreadCopierPas
sThrough<CrossThreadPersistent<T>> { | 144 struct CrossThreadCopier<CrossThreadPersistent<T>> : public CrossThreadCopierPas
sThrough<CrossThreadPersistent<T>> { |
| 144 STATIC_ONLY(CrossThreadCopier); | 145 STATIC_ONLY(CrossThreadCopier); |
| 145 }; | 146 }; |
| 146 | 147 |
| 147 template<typename T> | 148 template <typename T> |
| 149 struct CrossThreadCopier<WTF::WeakPtr<T>> : public CrossThreadCopierPassThrough<
WTF::WeakPtr<T>> { |
| 150 STATIC_ONLY(CrossThreadCopier); |
| 151 }; |
| 152 |
| 153 template <typename T> |
| 148 struct CrossThreadCopier<CrossThreadWeakPersistent<T>> : public CrossThreadCopie
rPassThrough<CrossThreadWeakPersistent<T>> { | 154 struct CrossThreadCopier<CrossThreadWeakPersistent<T>> : public CrossThreadCopie
rPassThrough<CrossThreadWeakPersistent<T>> { |
| 149 STATIC_ONLY(CrossThreadCopier); | 155 STATIC_ONLY(CrossThreadCopier); |
| 150 }; | 156 }; |
| 151 | 157 |
| 152 template<typename T> | 158 template<typename T> |
| 153 struct CrossThreadCopier<WTF::UnretainedWrapper<T, WTF::CrossThreadAffinity>> :
public CrossThreadCopierPassThrough<WTF::UnretainedWrapper<T, WTF::CrossThreadAf
finity>> { | 159 struct CrossThreadCopier<WTF::UnretainedWrapper<T, WTF::CrossThreadAffinity>> :
public CrossThreadCopierPassThrough<WTF::UnretainedWrapper<T, WTF::CrossThreadAf
finity>> { |
| 154 STATIC_ONLY(CrossThreadCopier); | 160 STATIC_ONLY(CrossThreadCopier); |
| 155 }; | 161 }; |
| 156 | 162 |
| 157 template<typename T> | 163 template <typename T> |
| 158 struct CrossThreadCopier<WeakPtr<T>> : public CrossThreadCopierPassThrough<WeakP
tr<T>> { | 164 struct CrossThreadCopier<RevocableCrossThreadWeakPersistent<T>> : public CrossTh
readCopierPassThrough<RevocableCrossThreadWeakPersistent<T>> { |
| 159 STATIC_ONLY(CrossThreadCopier); | 165 STATIC_ONLY(CrossThreadCopier); |
| 160 }; | 166 }; |
| 161 | 167 |
| 162 template <typename T> | 168 template <typename T> |
| 163 struct CrossThreadCopier<WTF::PassedWrapper<T>> { | 169 struct CrossThreadCopier<WTF::PassedWrapper<T>> { |
| 164 STATIC_ONLY(CrossThreadCopier); | 170 STATIC_ONLY(CrossThreadCopier); |
| 165 using Type = WTF::PassedWrapper<typename CrossThreadCopier<T>::Type>; | 171 using Type = WTF::PassedWrapper<typename CrossThreadCopier<T>::Type>; |
| 166 static Type copy(WTF::PassedWrapper<T>&& value) { return passed(CrossThreadC
opier<T>::copy(value.moveOut())); } | 172 static Type copy(WTF::PassedWrapper<T>&& value) { return passed(CrossThreadC
opier<T>::copy(value.moveOut())); } |
| 167 }; | 173 }; |
| 168 | 174 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 197 template <> | 203 template <> |
| 198 struct CrossThreadCopier<ResourceResponse> { | 204 struct CrossThreadCopier<ResourceResponse> { |
| 199 STATIC_ONLY(CrossThreadCopier); | 205 STATIC_ONLY(CrossThreadCopier); |
| 200 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceResponseData>>
Type; | 206 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceResponseData>>
Type; |
| 201 PLATFORM_EXPORT static Type copy(const ResourceResponse&); | 207 PLATFORM_EXPORT static Type copy(const ResourceResponse&); |
| 202 }; | 208 }; |
| 203 | 209 |
| 204 } // namespace blink | 210 } // namespace blink |
| 205 | 211 |
| 206 #endif // CrossThreadCopier_h | 212 #endif // CrossThreadCopier_h |
| OLD | NEW |