| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 NO_SANITIZE_ADDRESS | 168 NO_SANITIZE_ADDRESS |
| 169 T* atomicGet() { | 169 T* atomicGet() { |
| 170 return reinterpret_cast<T*>(acquireLoad(reinterpret_cast<void* volatile*>( | 170 return reinterpret_cast<T*>(acquireLoad(reinterpret_cast<void* volatile*>( |
| 171 const_cast<typename std::remove_const<T>::type**>(&m_raw)))); | 171 const_cast<typename std::remove_const<T>::type**>(&m_raw)))); |
| 172 } | 172 } |
| 173 | 173 |
| 174 private: | 174 private: |
| 175 NO_SANITIZE_ADDRESS | 175 NO_SANITIZE_ADDRESS |
| 176 void assign(T* ptr) { | 176 void assign(T* ptr) { |
| 177 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) { | 177 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) { |
| 178 releaseStore( | 178 CrossThreadPersistentRegion::LockScope persistentLock( |
| 179 reinterpret_cast<void* volatile*>( | 179 ProcessHeap::crossThreadPersistentRegion()); |
| 180 const_cast<typename std::remove_const<T>::type**>(&m_raw)), | 180 m_raw = ptr; |
| 181 const_cast<typename std::remove_const<T>::type*>(ptr)); | |
| 182 } else { | 181 } else { |
| 183 m_raw = ptr; | 182 m_raw = ptr; |
| 184 } | 183 } |
| 185 checkPointer(); | 184 checkPointer(); |
| 186 if (m_raw) { | 185 if (m_raw) { |
| 187 if (!m_persistentNode) | 186 if (!m_persistentNode) |
| 188 initialize(); | 187 initialize(); |
| 189 return; | 188 return; |
| 190 } | 189 } |
| 191 uninitialize(); | 190 uninitialize(); |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 static blink::CrossThreadPersistent<T> Unwrap( | 817 static blink::CrossThreadPersistent<T> Unwrap( |
| 819 const blink::CrossThreadWeakPersistent<T>& wrapped) { | 818 const blink::CrossThreadWeakPersistent<T>& wrapped) { |
| 820 blink::CrossThreadPersistentRegion::LockScope persistentLock( | 819 blink::CrossThreadPersistentRegion::LockScope persistentLock( |
| 821 blink::ProcessHeap::crossThreadPersistentRegion()); | 820 blink::ProcessHeap::crossThreadPersistentRegion()); |
| 822 return blink::CrossThreadPersistent<T>(wrapped.get()); | 821 return blink::CrossThreadPersistent<T>(wrapped.get()); |
| 823 } | 822 } |
| 824 }; | 823 }; |
| 825 } | 824 } |
| 826 | 825 |
| 827 #endif // Persistent_h | 826 #endif // Persistent_h |
| OLD | NEW |