OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 // Unlike Persistent, we can destruct a CrossThreadPersistent in a thread | 397 // Unlike Persistent, we can destruct a CrossThreadPersistent in a thread |
398 // different from the construction thread. | 398 // different from the construction thread. |
399 template<typename T> | 399 template<typename T> |
400 class CrossThreadPersistent : public Persistent<T, GlobalPersistents> { | 400 class CrossThreadPersistent : public Persistent<T, GlobalPersistents> { |
401 WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(CrossThreadPersistent); | 401 WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(CrossThreadPersistent); |
402 WTF_DISALLOW_ZERO_ASSIGNMENT(CrossThreadPersistent); | 402 WTF_DISALLOW_ZERO_ASSIGNMENT(CrossThreadPersistent); |
403 public: | 403 public: |
404 CrossThreadPersistent(T* raw) : Persistent<T, GlobalPersistents>(raw) { } | 404 CrossThreadPersistent(T* raw) : Persistent<T, GlobalPersistents>(raw) { } |
405 | 405 |
406 using Persistent<T, GlobalPersistents>::operator=; | 406 using Persistent<T, GlobalPersistents>::operator=; |
| 407 using Persistent<T, GlobalPersistents>::operator RawPtr<T>; |
407 }; | 408 }; |
408 | 409 |
409 // FIXME: derive affinity based on the collection. | 410 // FIXME: derive affinity based on the collection. |
410 template<typename Collection, ThreadAffinity Affinity = AnyThread> | 411 template<typename Collection, ThreadAffinity Affinity = AnyThread> |
411 class PersistentHeapCollectionBase | 412 class PersistentHeapCollectionBase |
412 : public Collection | 413 : public Collection |
413 , public PersistentBase<ThreadLocalPersistents<Affinity>, PersistentHeapColl
ectionBase<Collection, Affinity> > { | 414 , public PersistentBase<ThreadLocalPersistents<Affinity>, PersistentHeapColl
ectionBase<Collection, Affinity> > { |
414 // We overload the various new and delete operators with using the WTF Defau
ltAllocator to ensure persistent | 415 // We overload the various new and delete operators with using the WTF Defau
ltAllocator to ensure persistent |
415 // heap collections are always allocated off-heap. This allows persistent co
llections to be used in | 416 // heap collections are always allocated off-heap. This allows persistent co
llections to be used in |
416 // DEFINE_STATIC_LOCAL et. al. | 417 // DEFINE_STATIC_LOCAL et. al. |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli
neCapacity> > *> { | 1121 struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli
neCapacity> > *> { |
1121 // All heap allocated node pointers need visiting to keep the nodes alive, | 1122 // All heap allocated node pointers need visiting to keep the nodes alive, |
1122 // regardless of whether they contain pointers to other heap allocated | 1123 // regardless of whether they contain pointers to other heap allocated |
1123 // objects. | 1124 // objects. |
1124 static const bool value = true; | 1125 static const bool value = true; |
1125 }; | 1126 }; |
1126 | 1127 |
1127 } // namespace WTF | 1128 } // namespace WTF |
1128 | 1129 |
1129 #endif | 1130 #endif |
OLD | NEW |