OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef Persistent_h | 5 #ifndef Persistent_h |
6 #define Persistent_h | 6 #define Persistent_h |
7 | 7 |
8 #include "platform/heap/Heap.h" | 8 #include "platform/heap/Heap.h" |
9 #include "platform/heap/Member.h" | 9 #include "platform/heap/Member.h" |
10 #include "platform/heap/PersistentNode.h" | 10 #include "platform/heap/PersistentNode.h" |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 532 |
533 template <typename U> | 533 template <typename U> |
534 CrossThreadWeakPersistent& operator=(const Member<U>& other) { | 534 CrossThreadWeakPersistent& operator=(const Member<U>& other) { |
535 Parent::operator=(other); | 535 Parent::operator=(other); |
536 return *this; | 536 return *this; |
537 } | 537 } |
538 }; | 538 }; |
539 | 539 |
540 template <typename Collection> | 540 template <typename Collection> |
541 class PersistentHeapCollectionBase : public Collection { | 541 class PersistentHeapCollectionBase : public Collection { |
542 // We overload the various new and delete operators with using the WTF Partiti
onAllocator to ensure persistent | 542 // We overload the various new and delete operators with using the WTF |
543 // heap collections are always allocated off-heap. This allows persistent coll
ections to be used in | 543 // PartitionAllocator to ensure persistent heap collections are always |
| 544 // allocated off-heap. This allows persistent collections to be used in |
544 // DEFINE_STATIC_LOCAL et. al. | 545 // DEFINE_STATIC_LOCAL et. al. |
545 WTF_USE_ALLOCATOR(PersistentHeapCollectionBase, WTF::PartitionAllocator); | 546 WTF_USE_ALLOCATOR(PersistentHeapCollectionBase, WTF::PartitionAllocator); |
546 IS_PERSISTENT_REFERENCE_TYPE(); | 547 IS_PERSISTENT_REFERENCE_TYPE(); |
547 | 548 |
548 public: | 549 public: |
549 PersistentHeapCollectionBase() { initialize(); } | 550 PersistentHeapCollectionBase() { initialize(); } |
550 | 551 |
551 PersistentHeapCollectionBase(const PersistentHeapCollectionBase& other) | 552 PersistentHeapCollectionBase(const PersistentHeapCollectionBase& other) |
552 : Collection(other) { | 553 : Collection(other) { |
553 initialize(); | 554 initialize(); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 static blink::CrossThreadPersistent<T> Unwrap( | 803 static blink::CrossThreadPersistent<T> Unwrap( |
803 const blink::CrossThreadWeakPersistent<T>& wrapped) { | 804 const blink::CrossThreadWeakPersistent<T>& wrapped) { |
804 blink::CrossThreadPersistentRegion::LockScope persistentLock( | 805 blink::CrossThreadPersistentRegion::LockScope persistentLock( |
805 blink::ProcessHeap::crossThreadPersistentRegion()); | 806 blink::ProcessHeap::crossThreadPersistentRegion()); |
806 return blink::CrossThreadPersistent<T>(wrapped.get()); | 807 return blink::CrossThreadPersistent<T>(wrapped.get()); |
807 } | 808 } |
808 }; | 809 }; |
809 } | 810 } |
810 | 811 |
811 #endif // Persistent_h | 812 #endif // Persistent_h |
OLD | NEW |