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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 return *this; | 553 return *this; |
554 } | 554 } |
555 }; | 555 }; |
556 | 556 |
557 template <typename Collection> | 557 template <typename Collection> |
558 class PersistentHeapCollectionBase : public Collection { | 558 class PersistentHeapCollectionBase : public Collection { |
559 // We overload the various new and delete operators with using the WTF | 559 // We overload the various new and delete operators with using the WTF |
560 // PartitionAllocator to ensure persistent heap collections are always | 560 // PartitionAllocator to ensure persistent heap collections are always |
561 // allocated off-heap. This allows persistent collections to be used in | 561 // allocated off-heap. This allows persistent collections to be used in |
562 // DEFINE_STATIC_LOCAL et. al. | 562 // DEFINE_STATIC_LOCAL et. al. |
563 WTF_USE_ALLOCATOR(PersistentHeapCollectionBase, WTF::PartitionAllocator); | 563 USE_ALLOCATOR(PersistentHeapCollectionBase, WTF::PartitionAllocator); |
564 IS_PERSISTENT_REFERENCE_TYPE(); | 564 IS_PERSISTENT_REFERENCE_TYPE(); |
565 | 565 |
566 public: | 566 public: |
567 PersistentHeapCollectionBase() { initialize(); } | 567 PersistentHeapCollectionBase() { initialize(); } |
568 | 568 |
569 PersistentHeapCollectionBase(const PersistentHeapCollectionBase& other) | 569 PersistentHeapCollectionBase(const PersistentHeapCollectionBase& other) |
570 : Collection(other) { | 570 : Collection(other) { |
571 initialize(); | 571 initialize(); |
572 } | 572 } |
573 | 573 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 static blink::CrossThreadPersistent<T> Unwrap( | 820 static blink::CrossThreadPersistent<T> Unwrap( |
821 const blink::CrossThreadWeakPersistent<T>& wrapped) { | 821 const blink::CrossThreadWeakPersistent<T>& wrapped) { |
822 blink::CrossThreadPersistentRegion::LockScope persistentLock( | 822 blink::CrossThreadPersistentRegion::LockScope persistentLock( |
823 blink::ProcessHeap::crossThreadPersistentRegion()); | 823 blink::ProcessHeap::crossThreadPersistentRegion()); |
824 return blink::CrossThreadPersistent<T>(wrapped.get()); | 824 return blink::CrossThreadPersistent<T>(wrapped.get()); |
825 } | 825 } |
826 }; | 826 }; |
827 } | 827 } |
828 | 828 |
829 #endif // Persistent_h | 829 #endif // Persistent_h |
OLD | NEW |