| Index: Source/core/frame/LocalDOMWindow.cpp
|
| diff --git a/Source/core/frame/LocalDOMWindow.cpp b/Source/core/frame/LocalDOMWindow.cpp
|
| index 97179dffc684d668a491d62c2e04e7a5c7423c7c..80e2672f3cad3c879894b440e4490f84d77ba747 100644
|
| --- a/Source/core/frame/LocalDOMWindow.cpp
|
| +++ b/Source/core/frame/LocalDOMWindow.cpp
|
| @@ -270,6 +270,9 @@ LocalDOMWindow::LocalDOMWindow(LocalFrame& frame)
|
| , m_hasBeenReset(false)
|
| #endif
|
| {
|
| +#if ENABLE(OILPAN)
|
| + ThreadState::current()->registerPreFinalizer(*this);
|
| +#endif
|
| }
|
|
|
| void LocalDOMWindow::clearDocument()
|
| @@ -417,15 +420,6 @@ LocalDOMWindow::~LocalDOMWindow()
|
| #if ENABLE(OILPAN)
|
| // Cleared when detaching document.
|
| ASSERT(!m_eventQueue);
|
| -
|
| - // Oilpan: should the LocalDOMWindow be GCed along with its LocalFrame without the
|
| - // frame having first notified its observers of imminent destruction, the
|
| - // LocalDOMWindow will not have had an opportunity to remove event listeners.
|
| - //
|
| - // Non-Oilpan, LocalDOMWindow::reset() will always be invoked, the last opportunity
|
| - // being via ~LocalFrame's setDOMWindow() call. Asserted for below.
|
| - if (frame())
|
| - removeAllEventListeners();
|
| #else
|
| ASSERT(m_hasBeenReset);
|
| ASSERT(m_document->isStopped());
|
| @@ -433,6 +427,24 @@ LocalDOMWindow::~LocalDOMWindow()
|
| #endif
|
| }
|
|
|
| +void LocalDOMWindow::dispose()
|
| +{
|
| + // Oilpan: should the LocalDOMWindow be GCed along with its LocalFrame without the
|
| + // frame having first notified its observers of imminent destruction, the
|
| + // LocalDOMWindow will not have had an opportunity to remove event listeners.
|
| + //
|
| + // Arrange for that removal to happen using a prefinalizer action. Making LocalDOMWindow
|
| + // eager finalizable is problematic as other eagerly finalized objects may well
|
| + // want to access their associated LocalDOMWindow from their destructors.
|
| + //
|
| + // (Non-Oilpan, LocalDOMWindow::reset() will always be invoked, the last opportunity
|
| + // being via ~LocalFrame's setDOMWindow() call. Asserted for in the destructor.)
|
| + if (!frame())
|
| + return;
|
| +
|
| + removeAllEventListeners();
|
| +}
|
| +
|
| ExecutionContext* LocalDOMWindow::executionContext() const
|
| {
|
| return m_document.get();
|
|
|