| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 uninitialize(); | 190 uninitialize(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 template <typename VisitorDispatcher> | 193 template <typename VisitorDispatcher> |
| 194 void tracePersistent(VisitorDispatcher visitor) { | 194 void tracePersistent(VisitorDispatcher visitor) { |
| 195 static_assert(sizeof(T), "T must be fully defined"); | 195 static_assert(sizeof(T), "T must be fully defined"); |
| 196 static_assert(IsGarbageCollectedType<T>::value, | 196 static_assert(IsGarbageCollectedType<T>::value, |
| 197 "T needs to be a garbage collected object"); | 197 "T needs to be a garbage collected object"); |
| 198 if (weaknessConfiguration == WeakPersistentConfiguration) { | 198 if (weaknessConfiguration == WeakPersistentConfiguration) { |
| 199 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) | 199 visitor->registerWeakCallback(this, handleWeakPersistent); |
| 200 visitor->registerWeakCellWithCallback(reinterpret_cast<void**>(this), | |
| 201 handleWeakPersistent); | |
| 202 else | |
| 203 visitor->registerWeakMembers(this, m_raw, handleWeakPersistent); | |
| 204 } else { | 200 } else { |
| 205 visitor->mark(m_raw); | 201 visitor->mark(m_raw); |
| 206 } | 202 } |
| 207 } | 203 } |
| 208 | 204 |
| 209 NO_SANITIZE_ADDRESS | 205 NO_SANITIZE_ADDRESS |
| 210 void initialize() { | 206 void initialize() { |
| 211 ASSERT(!m_persistentNode); | 207 ASSERT(!m_persistentNode); |
| 212 if (!m_raw || isHashTableDeletedValue()) | 208 if (!m_raw || isHashTableDeletedValue()) |
| 213 return; | 209 return; |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 static blink::CrossThreadPersistent<T> Unwrap( | 805 static blink::CrossThreadPersistent<T> Unwrap( |
| 810 const blink::CrossThreadWeakPersistent<T>& wrapped) { | 806 const blink::CrossThreadWeakPersistent<T>& wrapped) { |
| 811 blink::CrossThreadPersistentRegion::LockScope persistentLock( | 807 blink::CrossThreadPersistentRegion::LockScope persistentLock( |
| 812 blink::ProcessHeap::crossThreadPersistentRegion()); | 808 blink::ProcessHeap::crossThreadPersistentRegion()); |
| 813 return blink::CrossThreadPersistent<T>(wrapped.get()); | 809 return blink::CrossThreadPersistent<T>(wrapped.get()); |
| 814 } | 810 } |
| 815 }; | 811 }; |
| 816 } | 812 } |
| 817 | 813 |
| 818 #endif // Persistent_h | 814 #endif // Persistent_h |
| OLD | NEW |