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