Chromium Code Reviews| 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 338adf2b4ca7ba114ac580986d81928571d3d502..f21aa4306ccc4f1d730209f7298c90f7fd752944 100644 |
| --- a/third_party/WebKit/Source/platform/heap/PersistentNode.h |
| +++ b/third_party/WebKit/Source/platform/heap/PersistentNode.h |
| @@ -188,6 +188,38 @@ private: |
| Mutex m_mutex; |
| }; |
| +class XThreadPersistentRegion final { |
|
haraken
2016/01/07 08:06:22
XThreadPersistentRegion and CrossThreadPersistentR
|
| +public: |
| + XThreadPersistentRegion() : m_persistentRegion(adoptPtr(new PersistentRegion)) { } |
| + |
| + PersistentNode* allocatePersistentNode(void* self, TraceCallback trace) |
| + { |
| + MutexLocker lock(m_mutex); |
| + return m_persistentRegion->allocatePersistentNode(self, trace); |
| + } |
| + |
| + void freePersistentNode(PersistentNode* persistentNode) |
| + { |
| + MutexLocker lock(m_mutex); |
| + m_persistentRegion->freePersistentNode(persistentNode); |
| + } |
| + |
| + void tracePersistentNodes(Visitor* visitor) |
| + { |
| + MutexLocker lock(m_mutex); |
| + m_persistentRegion->tracePersistentNodes(visitor); |
| + } |
| + |
| + void prepareForThreadStateTermination(ThreadState*); |
| + |
| +private: |
| + // We don't make CrossThreadPersistentRegion inherit from PersistentRegion |
| + // because we don't want to virtualize performance-sensitive methods |
| + // such as PersistentRegion::allocate/freePersistentNode. |
| + OwnPtr<PersistentRegion> m_persistentRegion; |
| + Mutex m_mutex; |
| +}; |
| + |
| } // namespace blink |
| #endif |