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

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

Issue 1904003002: CrossThreadPersistentRegion will only trace objects belonging to the current GCing ThreadHeap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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.cpp
diff --git a/third_party/WebKit/Source/platform/heap/PersistentNode.cpp b/third_party/WebKit/Source/platform/heap/PersistentNode.cpp
index f04607740e9eb5bf7774660a44243ba930e47d59..563f0fd7844b861ff5180cb20983623f600bd929 100644
--- a/third_party/WebKit/Source/platform/heap/PersistentNode.cpp
+++ b/third_party/WebKit/Source/platform/heap/PersistentNode.cpp
@@ -73,7 +73,7 @@ void PersistentRegion::releasePersistentNode(PersistentNode* persistentNode, Thr
// a PersistentNodeSlot that contains only freed PersistentNodes,
// we delete the PersistentNodeSlot. This function rebuilds the free
// list of PersistentNodes.
-void PersistentRegion::tracePersistentNodes(Visitor* visitor)
+void PersistentRegion::tracePersistentNodes(Visitor* visitor, ShouldTraceCallback shouldTrace)
{
size_t debugMarkedObjectSize = ProcessHeap::totalMarkedObjectSize();
base::debug::Alias(&debugMarkedObjectSize);
@@ -95,8 +95,10 @@ void PersistentRegion::tracePersistentNodes(Visitor* visitor)
freeListNext = node;
++freeCount;
} else {
- node->tracePersistentNode(visitor);
++persistentCount;
+ if (!shouldTrace(visitor, node))
+ continue;
+ node->tracePersistentNode(visitor);
debugMarkedObjectSize = ProcessHeap::totalMarkedObjectSize();
}
}
@@ -119,6 +121,16 @@ void PersistentRegion::tracePersistentNodes(Visitor* visitor)
ASSERT(persistentCount == m_persistentCount);
}
+bool CrossThreadPersistentRegion::shouldTracePersistentNode(Visitor* visitor, PersistentNode* node)
+{
+ CrossThreadPersistent<DummyGCBase>* persistent = reinterpret_cast<CrossThreadPersistent<DummyGCBase>*>(node->self());
+ ASSERT(persistent);
+ Address rawObject = reinterpret_cast<Address>(persistent->get());
+ if (!rawObject)
+ return false;
+ return &visitor->heap() == &ThreadState::fromObject(rawObject)->heap();
+}
+
void CrossThreadPersistentRegion::prepareForThreadStateTermination(ThreadState* threadState)
{
// For heaps belonging to a thread that's detaching, any cross-thread persistents
« no previous file with comments | « third_party/WebKit/Source/platform/heap/PersistentNode.h ('k') | third_party/WebKit/Source/platform/heap/Visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698