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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 template <typename T> | 246 template <typename T> |
247 struct CrossThreadCopier<AllowCrossThreadAccessWrapper<T>> { | 247 struct CrossThreadCopier<AllowCrossThreadAccessWrapper<T>> { |
248 STATIC_ONLY(CrossThreadCopier); | 248 STATIC_ONLY(CrossThreadCopier); |
249 typedef T Type; | 249 typedef T Type; |
250 static Type copy(const AllowCrossThreadAccessWrapper<T>& wrapper) { return w
rapper.value(); } | 250 static Type copy(const AllowCrossThreadAccessWrapper<T>& wrapper) { return w
rapper.value(); } |
251 }; | 251 }; |
252 | 252 |
253 template <typename T> | 253 template <typename T> |
254 AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value) | 254 AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value) |
255 { | 255 { |
256 static_assert(!blink::IsGarbageCollectedType<T>::value, "Use wrapCrossThread
Persistent() 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 |