Chromium Code Reviews| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 | 142 |
| 143 template <typename T, typename Deleter> | 143 template <typename T, typename Deleter> |
| 144 struct CrossThreadCopier<std::unique_ptr<T, Deleter>> { | 144 struct CrossThreadCopier<std::unique_ptr<T, Deleter>> { |
| 145 STATIC_ONLY(CrossThreadCopier); | 145 STATIC_ONLY(CrossThreadCopier); |
| 146 using Type = std::unique_ptr<T, Deleter>; | 146 using Type = std::unique_ptr<T, Deleter>; |
| 147 static std::unique_ptr<T, Deleter> copy(std::unique_ptr<T, Deleter> pointer) { | 147 static std::unique_ptr<T, Deleter> copy(std::unique_ptr<T, Deleter> pointer) { |
| 148 return pointer; // This is in fact a move. | 148 return pointer; // This is in fact a move. |
| 149 } | 149 } |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 template <typename T, size_t inlineCapacity, typename Allocator> | |
| 153 struct CrossThreadCopier<Vector<T, inlineCapacity, Allocator>> { | |
| 154 STATIC_ONLY(CrossThreadCopier); | |
| 155 using Type = Vector<T, inlineCapacity, Allocator>; | |
| 156 static Vector<T, inlineCapacity, Allocator> copy( | |
| 157 Vector<T, inlineCapacity, Allocator> pointer) { | |
| 158 return pointer; // This is in fact a move. | |
| 159 } | |
| 160 }; | |
|
kinuko
2017/02/08 09:45:06
Hmm, I think having CrossThreadCoppier for generic
darin (slow to review)
2017/02/08 17:09:18
Great suggestion. That works perfectly.
| |
| 161 | |
| 152 template <typename T> | 162 template <typename T> |
| 153 struct CrossThreadCopier<CrossThreadPersistent<T>> | 163 struct CrossThreadCopier<CrossThreadPersistent<T>> |
| 154 : public CrossThreadCopierPassThrough<CrossThreadPersistent<T>> { | 164 : public CrossThreadCopierPassThrough<CrossThreadPersistent<T>> { |
| 155 STATIC_ONLY(CrossThreadCopier); | 165 STATIC_ONLY(CrossThreadCopier); |
| 156 }; | 166 }; |
| 157 | 167 |
| 158 template <typename T> | 168 template <typename T> |
| 159 struct CrossThreadCopier<CrossThreadWeakPersistent<T>> | 169 struct CrossThreadCopier<CrossThreadWeakPersistent<T>> |
| 160 : public CrossThreadCopierPassThrough<CrossThreadWeakPersistent<T>> { | 170 : public CrossThreadCopierPassThrough<CrossThreadWeakPersistent<T>> { |
| 161 STATIC_ONLY(CrossThreadCopier); | 171 STATIC_ONLY(CrossThreadCopier); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 struct CrossThreadCopier<ResourceResponse> { | 226 struct CrossThreadCopier<ResourceResponse> { |
| 217 STATIC_ONLY(CrossThreadCopier); | 227 STATIC_ONLY(CrossThreadCopier); |
| 218 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceResponseData>> | 228 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceResponseData>> |
| 219 Type; | 229 Type; |
| 220 PLATFORM_EXPORT static Type copy(const ResourceResponse&); | 230 PLATFORM_EXPORT static Type copy(const ResourceResponse&); |
| 221 }; | 231 }; |
| 222 | 232 |
| 223 } // namespace blink | 233 } // namespace blink |
| 224 | 234 |
| 225 #endif // CrossThreadCopier_h | 235 #endif // CrossThreadCopier_h |
| OLD | NEW |