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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 struct CrossThreadCopier<AllowCrossThreadAccessWrapper<T>> { | 244 struct CrossThreadCopier<AllowCrossThreadAccessWrapper<T>> { |
245 STATIC_ONLY(CrossThreadCopier); | 245 STATIC_ONLY(CrossThreadCopier); |
246 typedef T Type; | 246 typedef T Type; |
247 static Type copy(const AllowCrossThreadAccessWrapper<T>& wrapper) { return w
rapper.value(); } | 247 static Type copy(const AllowCrossThreadAccessWrapper<T>& wrapper) { return w
rapper.value(); } |
248 }; | 248 }; |
249 | 249 |
250 template <typename T> | 250 template <typename T> |
251 AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value) | 251 AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value) |
252 { | 252 { |
253 static_assert(!blink::IsGarbageCollectedType<T>::value, "Use wrapCrossThread
Persistent() instead for garbage-collected pointers"); | 253 static_assert(!blink::IsGarbageCollectedType<T>::value, "Use wrapCrossThread
Persistent() instead for garbage-collected pointers"); |
| 254 static_assert(!WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "U
se PassRefPtr<T> instead for ThreadSafeRefCounted"); |
254 return AllowCrossThreadAccessWrapper<T*>(value); | 255 return AllowCrossThreadAccessWrapper<T*>(value); |
255 } | 256 } |
256 | 257 |
257 template <typename T> | 258 template <typename T> |
258 AllowCrossThreadAccessWrapper<const WeakPtr<T>&> AllowCrossThreadAccess(const We
akPtr<T>& value) | 259 AllowCrossThreadAccessWrapper<const WeakPtr<T>&> AllowCrossThreadAccess(const We
akPtr<T>& value) |
259 { | 260 { |
260 return AllowCrossThreadAccessWrapper<const WeakPtr<T>&>(value); | 261 return AllowCrossThreadAccessWrapper<const WeakPtr<T>&>(value); |
261 } | 262 } |
262 | 263 |
263 } // namespace blink | 264 } // namespace blink |
264 | 265 |
265 #endif // CrossThreadCopier_h | 266 #endif // CrossThreadCopier_h |
OLD | NEW |