| 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 | |
| 222 static bool shouldTracePersistentNode(Visitor*, PersistentNode*); | 221 static bool shouldTracePersistentNode(Visitor*, PersistentNode*); |
| 223 | 222 |
| 224 private: | 223 private: |
| 225 friend class LockScope; | 224 friend class LockScope; |
| 226 | 225 |
| 227 void lock() { m_mutex.lock(); } | 226 void lock() { m_mutex.lock(); } |
| 228 | 227 |
| 229 void unlock() { m_mutex.unlock(); } | 228 void unlock() { m_mutex.unlock(); } |
| 230 | 229 |
| 231 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion | 230 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion |
| 232 // because we don't want to virtualize performance-sensitive methods | 231 // because we don't want to virtualize performance-sensitive methods |
| 233 // such as PersistentRegion::allocate/freePersistentNode. | 232 // such as PersistentRegion::allocate/freePersistentNode. |
| 234 std::unique_ptr<PersistentRegion> m_persistentRegion; | 233 std::unique_ptr<PersistentRegion> m_persistentRegion; |
| 235 | 234 |
| 236 // Recursive as prepareForThreadStateTermination() clears a PersistentNode's | 235 // Recursive as prepareForThreadStateTermination() clears a PersistentNode's |
| 237 // associated Persistent<> -- it in turn freeing the PersistentNode. And both | 236 // associated Persistent<> -- it in turn freeing the PersistentNode. And both |
| 238 // CrossThreadPersistentRegion operations need a lock on the region before | 237 // CrossThreadPersistentRegion operations need a lock on the region before |
| 239 // mutating. | 238 // mutating. |
| 240 RecursiveMutex m_mutex; | 239 RecursiveMutex m_mutex; |
| 241 }; | 240 }; |
| 242 | 241 |
| 243 } // namespace blink | 242 } // namespace blink |
| 244 | 243 |
| 245 #endif | 244 #endif |
| OLD | NEW |