Chromium Code Reviews| 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 abd7a1264515f10cbda31c100d1ff52405b54007..6c6923fc2a8c84b4c7a3590f18effa2483ea8dfa 100644 |
| --- a/third_party/WebKit/Source/platform/heap/PersistentNode.cpp |
| +++ b/third_party/WebKit/Source/platform/heap/PersistentNode.cpp |
| @@ -49,7 +49,7 @@ void PersistentRegion::ensurePersistentNodeSlots(void* self, TraceCallback trace |
| // 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, bool (*shouldTrace)(Visitor*, PersistentNode*)) |
| { |
| m_freeListHead = nullptr; |
| int persistentCount = 0; |
| @@ -68,6 +68,8 @@ void PersistentRegion::tracePersistentNodes(Visitor* visitor) |
| freeListNext = node; |
| ++freeCount; |
| } else { |
| + if (shouldTrace && !shouldTrace(visitor, node)) |
| + return; |
|
haraken
2016/01/28 15:52:50
Shouldn't this be 'continue'?
keishi
2016/02/29 06:02:33
Done.
|
| node->tracePersistentNode(visitor); |
| ++persistentCount; |
| } |
| @@ -98,6 +100,17 @@ public: |
| }; |
| } |
| +bool CrossThreadPersistentRegion::shouldTracePersistentNode(Visitor* visitor, PersistentNode* node) |
| +{ |
|
haraken
2016/01/28 15:52:50
Add ASSERT(!node->isUnused()).
keishi
2016/02/29 06:02:33
Done.
|
| + CrossThreadPersistent<GCObject>* persistent = reinterpret_cast<CrossThreadPersistent<GCObject>*>(node->self()); |
| + ASSERT(persistent); |
| + Address rawObject = reinterpret_cast<Address>(persistent->get()); |
| + // TODO: Why do we need to return true? |
|
haraken
2016/01/28 15:52:50
I wonder why as well :) This should return false.
keishi
2016/02/29 06:02:33
Thanks, looks like it was.
|
| + if (!rawObject) |
| + return true; |
| + return visitor->gcData()->threadState()->gcGroup()->threads().contains(ThreadState::forObject(rawObject)); |
|
haraken
2016/01/28 15:52:50
forObject => fromAddress (for consistency with Hea
keishi
2016/02/29 06:02:33
Done.
|
| +} |
| + |
| void CrossThreadPersistentRegion::prepareForThreadStateTermination(ThreadState* threadState) |
| { |
| // For heaps belonging to a thread that's detaching, any cross-thread persistents |