| 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
|
|
|