| Index: third_party/WebKit/Source/platform/heap/Persistent.h
|
| diff --git a/third_party/WebKit/Source/platform/heap/Persistent.h b/third_party/WebKit/Source/platform/heap/Persistent.h
|
| index cf48b4999cb220e2d1de7bad996087414fd7474d..b3cfa449af04c7eb66b9f4e7f90f83f8028ef768 100644
|
| --- a/third_party/WebKit/Source/platform/heap/Persistent.h
|
| +++ b/third_party/WebKit/Source/platform/heap/Persistent.h
|
| @@ -182,11 +182,10 @@ private:
|
| {
|
| static_assert(sizeof(T), "T must be fully defined");
|
| static_assert(IsGarbageCollectedType<T>::value, "T needs to be a garbage collected object");
|
| - if (weaknessConfiguration == WeakPersistentConfiguration) {
|
| - visitor->registerWeakCell(&m_raw);
|
| - } else {
|
| + if (weaknessConfiguration == WeakPersistentConfiguration)
|
| + visitor->registerWeakMembers(this, m_raw, handleWeakPersistent);
|
| + else
|
| visitor->mark(m_raw);
|
| - }
|
| }
|
|
|
| NO_LAZY_SWEEP_SANITIZE_ADDRESS
|
| @@ -196,7 +195,7 @@ private:
|
| if (!m_raw || isHashTableDeletedValue())
|
| return;
|
|
|
| - TraceCallback traceCallback = TraceMethodDelegate<PersistentBase<T, weaknessConfiguration, crossThreadnessConfiguration>, &PersistentBase<T, weaknessConfiguration, crossThreadnessConfiguration>::tracePersistent>::trampoline;
|
| + TraceCallback traceCallback = TraceMethodDelegate<PersistentBase, &PersistentBase::tracePersistent>::trampoline;
|
| if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) {
|
| ProcessHeap::crossThreadPersistentRegion().allocatePersistentNode(m_persistentNode, this, traceCallback);
|
| return;
|
| @@ -245,6 +244,14 @@ private:
|
| #endif
|
| }
|
|
|
| + static void handleWeakPersistent(Visitor* self, void* object)
|
| + {
|
| + using Base = PersistentBase<typename std::remove_const<T>::type, weaknessConfiguration, crossThreadnessConfiguration>;
|
| + Base* persistent = reinterpret_cast<Base*>(object);
|
| + if (persistent->get() && !ObjectAliveTrait<T>::isHeapObjectAlive(persistent->get()))
|
| + persistent->clear();
|
| + }
|
| +
|
| // m_raw is accessed most, so put it at the first field.
|
| T* m_raw;
|
| PersistentNode* m_persistentNode = nullptr;
|
|
|