Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Unified Diff: third_party/WebKit/Source/platform/heap/PersistentNode.h

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698