Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(957)

Unified Diff: Source/core/frame/LocalDOMWindow.cpp

Issue 1166163003: Oilpan: revert back to a prefinalizer for LocalDOMWindow. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698