| Index: third_party/WebKit/Source/platform/heap/PersistentNode.h
|
| diff --git a/third_party/WebKit/Source/platform/heap/PersistentNode.h b/third_party/WebKit/Source/platform/heap/PersistentNode.h
|
| index ebaf0604edc31cd3090c6accc3988d1193c62ec1..41d9c1941fba17863f62749ac8d229597a70373a 100644
|
| --- a/third_party/WebKit/Source/platform/heap/PersistentNode.h
|
| +++ b/third_party/WebKit/Source/platform/heap/PersistentNode.h
|
| @@ -180,15 +180,44 @@ public:
|
| m_persistentRegion->freePersistentNode(persistentNode);
|
| }
|
|
|
| + class LockScope final {
|
| + STACK_ALLOCATED();
|
| + public:
|
| + LockScope(CrossThreadPersistentRegion& persistentRegion)
|
| + : m_persistentRegion(persistentRegion)
|
| + {
|
| + m_persistentRegion.lock();
|
| + }
|
| + ~LockScope()
|
| + {
|
| + m_persistentRegion.unlock();
|
| + }
|
| + private:
|
| + CrossThreadPersistentRegion& m_persistentRegion;
|
| + };
|
| +
|
| void tracePersistentNodes(Visitor* visitor)
|
| {
|
| - MutexLocker lock(m_mutex);
|
| + // If this assert triggers, you're tracing without being in a LockScope.
|
| + ASSERT(m_mutex.locked());
|
| m_persistentRegion->tracePersistentNodes(visitor);
|
| }
|
|
|
| void prepareForThreadStateTermination(ThreadState*);
|
|
|
| private:
|
| + friend class LockScope;
|
| +
|
| + void lock()
|
| + {
|
| + m_mutex.lock();
|
| + }
|
| +
|
| + void unlock()
|
| + {
|
| + m_mutex.unlock();
|
| + }
|
| +
|
| // We don't make CrossThreadPersistentRegion inherit from PersistentRegion
|
| // because we don't want to virtualize performance-sensitive methods
|
| // such as PersistentRegion::allocate/freePersistentNode.
|
|
|