| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 ThreadState::current()->registerStaticPersistentNode(m_persistentNode, | 160 ThreadState::current()->registerStaticPersistentNode(m_persistentNode, |
| 161 nullptr); | 161 nullptr); |
| 162 LEAK_SANITIZER_IGNORE_OBJECT(this); | 162 LEAK_SANITIZER_IGNORE_OBJECT(this); |
| 163 } | 163 } |
| 164 return this; | 164 return this; |
| 165 } | 165 } |
| 166 | 166 |
| 167 protected: | 167 protected: |
| 168 NO_SANITIZE_ADDRESS | 168 NO_SANITIZE_ADDRESS |
| 169 T* atomicGet() { | 169 T* atomicGet() { |
| 170 return reinterpret_cast<T*>( | 170 return reinterpret_cast<T*>(acquireLoad(reinterpret_cast<void* volatile*>( |
| 171 acquireLoad(reinterpret_cast<void* volatile*>(&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(reinterpret_cast<void* volatile*>(&m_raw), ptr); | 178 releaseStore( |
| 179 else | 179 reinterpret_cast<void* volatile*>( |
| 180 const_cast<typename std::remove_const<T>::type**>(&m_raw)), |
| 181 const_cast<typename std::remove_const<T>::type*>(ptr)); |
| 182 } else { |
| 180 m_raw = ptr; | 183 m_raw = ptr; |
| 184 } |
| 181 checkPointer(); | 185 checkPointer(); |
| 182 if (m_raw) { | 186 if (m_raw) { |
| 183 if (!m_persistentNode) | 187 if (!m_persistentNode) |
| 184 initialize(); | 188 initialize(); |
| 185 return; | 189 return; |
| 186 } | 190 } |
| 187 uninitialize(); | 191 uninitialize(); |
| 188 } | 192 } |
| 189 | 193 |
| 190 template <typename VisitorDispatcher> | 194 template <typename VisitorDispatcher> |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 static blink::CrossThreadPersistent<T> Unwrap( | 820 static blink::CrossThreadPersistent<T> Unwrap( |
| 817 const blink::CrossThreadWeakPersistent<T>& wrapped) { | 821 const blink::CrossThreadWeakPersistent<T>& wrapped) { |
| 818 blink::CrossThreadPersistentRegion::LockScope persistentLock( | 822 blink::CrossThreadPersistentRegion::LockScope persistentLock( |
| 819 blink::ProcessHeap::crossThreadPersistentRegion()); | 823 blink::ProcessHeap::crossThreadPersistentRegion()); |
| 820 return blink::CrossThreadPersistent<T>(wrapped.get()); | 824 return blink::CrossThreadPersistent<T>(wrapped.get()); |
| 821 } | 825 } |
| 822 }; | 826 }; |
| 823 } | 827 } |
| 824 | 828 |
| 825 #endif // Persistent_h | 829 #endif // Persistent_h |
| OLD | NEW |