| Index: Source/core/frame/LocalFrameLifecycleNotifier.cpp
|
| diff --git a/Source/core/frame/LocalFrameLifecycleNotifier.cpp b/Source/core/frame/LocalFrameLifecycleNotifier.cpp
|
| index 434cf8bc2c36ffdc0ddd766b23b124726e87aeca..828226710e1ae5ba7d5b04073d453d4b1c2eb811 100644
|
| --- a/Source/core/frame/LocalFrameLifecycleNotifier.cpp
|
| +++ b/Source/core/frame/LocalFrameLifecycleNotifier.cpp
|
| @@ -12,8 +12,22 @@ namespace blink {
|
| void LocalFrameLifecycleNotifier::notifyWillDetachFrameHost()
|
| {
|
| TemporaryChange<IterationType> scope(m_iterating, IteratingOverAll);
|
| +#if !ENABLE(OILPAN)
|
| + // Notifications perform unknown amounts of heap allocations,
|
| + // which might trigger (conservative) GCs. This will flush out
|
| + // dead observers, causing the _non-heap_ set be updated. Snapshot
|
| + // the observers and explicitly check if they're still alive before
|
| + // notifying.
|
| + Vector<RawPtr<LocalFrameLifecycleObserver>> snapshotOfObservers;
|
| + copyToVector(m_observers, snapshotOfObservers);
|
| + for (LocalFrameLifecycleObserver* observer : snapshotOfObservers) {
|
| + if (m_observers.contains(observer))
|
| + observer->willDetachFrameHost();
|
| + }
|
| +#else
|
| for (LocalFrameLifecycleObserver* observer : m_observers)
|
| observer->willDetachFrameHost();
|
| +#endif
|
| }
|
|
|
| } // namespace blink
|
|
|