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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 template <typename T> | 137 template <typename T> |
138 struct CrossThreadCopier<PassOwnPtr<T>> { | 138 struct CrossThreadCopier<PassOwnPtr<T>> { |
139 STATIC_ONLY(CrossThreadCopier); | 139 STATIC_ONLY(CrossThreadCopier); |
140 typedef PassOwnPtr<T> Type; | 140 typedef PassOwnPtr<T> Type; |
141 static Type copy(Type ownPtr) | 141 static Type copy(Type ownPtr) |
142 { | 142 { |
143 return ownPtr; | 143 return ownPtr; |
144 } | 144 } |
145 }; | 145 }; |
146 | 146 |
147 template <typename T> | 147 template <typename T, typename Deleter> |
148 struct CrossThreadCopier<std::unique_ptr<T>> { | 148 struct CrossThreadCopier<std::unique_ptr<T, Deleter>> { |
149 STATIC_ONLY(CrossThreadCopier); | 149 STATIC_ONLY(CrossThreadCopier); |
150 using Type = std::unique_ptr<T>; | 150 using Type = std::unique_ptr<T, Deleter>; |
151 static std::unique_ptr<T> copy(std::unique_ptr<T> pointer) | 151 static std::unique_ptr<T, Deleter> copy(std::unique_ptr<T, Deleter> pointer) |
152 { | 152 { |
153 return pointer; // This is in fact a move. | 153 return pointer; // This is in fact a move. |
154 } | 154 } |
155 }; | 155 }; |
156 | 156 |
157 template<typename T> | 157 template<typename T> |
158 struct CrossThreadCopier<CrossThreadPersistent<T>> : public CrossThreadCopierPas
sThrough<CrossThreadPersistent<T>> { | 158 struct CrossThreadCopier<CrossThreadPersistent<T>> : public CrossThreadCopierPas
sThrough<CrossThreadPersistent<T>> { |
159 STATIC_ONLY(CrossThreadCopier); | 159 STATIC_ONLY(CrossThreadCopier); |
160 }; | 160 }; |
161 | 161 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value) | 254 AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value) |
255 { | 255 { |
256 static_assert(!IsGarbageCollectedType<T>::value, "Use wrapCrossThreadPersist
ent() instead for garbage-collected pointers"); | 256 static_assert(!IsGarbageCollectedType<T>::value, "Use wrapCrossThreadPersist
ent() instead for garbage-collected pointers"); |
257 static_assert(!WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "U
se PassRefPtr<T> instead for ThreadSafeRefCounted"); | 257 static_assert(!WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "U
se PassRefPtr<T> instead for ThreadSafeRefCounted"); |
258 return AllowCrossThreadAccessWrapper<T*>(value); | 258 return AllowCrossThreadAccessWrapper<T*>(value); |
259 } | 259 } |
260 | 260 |
261 } // namespace blink | 261 } // namespace blink |
262 | 262 |
263 #endif // CrossThreadCopier_h | 263 #endif // CrossThreadCopier_h |
OLD | NEW |