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/Member.h" | 8 #include "platform/heap/Member.h" |
9 #include "platform/heap/PersistentNode.h" | 9 #include "platform/heap/PersistentNode.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 private: | 174 private: |
175 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 175 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
176 void assign(T* ptr) | 176 void assign(T* ptr) |
177 { | 177 { |
178 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) | 178 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) |
179 releaseStore(reinterpret_cast<void* volatile*>(&m_raw), ptr); | 179 releaseStore(reinterpret_cast<void* volatile*>(&m_raw), ptr); |
180 else | 180 else |
181 m_raw = ptr; | 181 m_raw = ptr; |
182 checkPointer(); | 182 checkPointer(); |
| 183 ASSERT(ThreadState::current()); |
183 if (m_raw) { | 184 if (m_raw) { |
184 if (!m_persistentNode) | 185 if (!m_persistentNode) |
185 initialize(); | 186 initialize(); |
186 return; | 187 return; |
187 } | 188 } |
188 uninitialize(); | 189 uninitialize(); |
189 } | 190 } |
190 | 191 |
191 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 192 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
192 void initialize() | 193 void initialize() |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 // into it. | 743 // into it. |
743 // | 744 // |
744 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like | 745 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like |
745 // CrossThreadWeakPersistent<>. | 746 // CrossThreadWeakPersistent<>. |
746 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } | 747 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } |
747 }; | 748 }; |
748 | 749 |
749 } // namespace WTF | 750 } // namespace WTF |
750 | 751 |
751 #endif // Persistent_h | 752 #endif // Persistent_h |
OLD | NEW |