OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 PersistentNode_h | 5 #ifndef PersistentNode_h |
6 #define PersistentNode_h | 6 #define PersistentNode_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/heap/ThreadState.h" | 9 #include "platform/heap/ThreadState.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // If this assert triggers, you're tracing without being in a LockScope. | 211 // If this assert triggers, you're tracing without being in a LockScope. |
212 #if ENABLE(ASSERT) | 212 #if ENABLE(ASSERT) |
213 DCHECK(m_mutex.locked()); | 213 DCHECK(m_mutex.locked()); |
214 #endif | 214 #endif |
215 m_persistentRegion->tracePersistentNodes( | 215 m_persistentRegion->tracePersistentNodes( |
216 visitor, CrossThreadPersistentRegion::shouldTracePersistentNode); | 216 visitor, CrossThreadPersistentRegion::shouldTracePersistentNode); |
217 } | 217 } |
218 | 218 |
219 void prepareForThreadStateTermination(ThreadState*); | 219 void prepareForThreadStateTermination(ThreadState*); |
220 | 220 |
221 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 221 NO_SANITIZE_ADDRESS |
222 static bool shouldTracePersistentNode(Visitor*, PersistentNode*); | 222 static bool shouldTracePersistentNode(Visitor*, PersistentNode*); |
223 | 223 |
224 private: | 224 private: |
225 friend class LockScope; | 225 friend class LockScope; |
226 | 226 |
227 void lock() { m_mutex.lock(); } | 227 void lock() { m_mutex.lock(); } |
228 | 228 |
229 void unlock() { m_mutex.unlock(); } | 229 void unlock() { m_mutex.unlock(); } |
230 | 230 |
231 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion | 231 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion |
232 // because we don't want to virtualize performance-sensitive methods | 232 // because we don't want to virtualize performance-sensitive methods |
233 // such as PersistentRegion::allocate/freePersistentNode. | 233 // such as PersistentRegion::allocate/freePersistentNode. |
234 std::unique_ptr<PersistentRegion> m_persistentRegion; | 234 std::unique_ptr<PersistentRegion> m_persistentRegion; |
235 | 235 |
236 // Recursive as prepareForThreadStateTermination() clears a PersistentNode's | 236 // Recursive as prepareForThreadStateTermination() clears a PersistentNode's |
237 // associated Persistent<> -- it in turn freeing the PersistentNode. And both | 237 // associated Persistent<> -- it in turn freeing the PersistentNode. And both |
238 // CrossThreadPersistentRegion operations need a lock on the region before | 238 // CrossThreadPersistentRegion operations need a lock on the region before |
239 // mutating. | 239 // mutating. |
240 RecursiveMutex m_mutex; | 240 RecursiveMutex m_mutex; |
241 }; | 241 }; |
242 | 242 |
243 } // namespace blink | 243 } // namespace blink |
244 | 244 |
245 #endif | 245 #endif |
OLD | NEW |