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

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

Issue 292503006: Oilpan: add [WillBeGarbageCollected] for Node. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add now-required tracing of m_domWindow (oops) Created 6 years, 7 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/DOMWindow.h ('k') | Source/web/tests/ScrollingCoordinatorChromiumTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/DOMWindow.cpp
diff --git a/Source/core/frame/DOMWindow.cpp b/Source/core/frame/DOMWindow.cpp
index 3b2c2b9012b322e5ed2606ea54dbd332fe7d9d8f..10cc6fb36e4189c374080919ff257648bf7b43a6 100644
--- a/Source/core/frame/DOMWindow.cpp
+++ b/Source/core/frame/DOMWindow.cpp
@@ -348,7 +348,7 @@ void DOMWindow::clearDocument()
m_document->detach();
}
- // FIXME: This should be part of ActiveDOM Object shutdown
+ // FIXME: This should be part of ActiveDOMObject shutdown
clearEventQueue();
m_document->clearDOMWindow();
@@ -489,15 +489,20 @@ DOMWindow::~DOMWindow()
ASSERT(m_hasBeenReset);
reset();
- removeAllEventListeners();
-
#if ENABLE(OILPAN)
- ASSERT(m_document->isDisposed());
+ // Oilpan: the frame host and document objects are
+ // also garbage collected; cannot notify these
+ // when removing event listeners.
+ removeAllEventListenersInternal(DoNotBroadcastListenerRemoval);
+
+ // Cleared when detaching document.
+ ASSERT(!m_eventQueue);
#else
- ASSERT(m_document->isStopped());
-#endif
+ removeAllEventListenersInternal(DoBroadcastListenerRemoval);
+ ASSERT(m_document->isStopped());
clearDocument();
+#endif
}
const AtomicString& DOMWindow::interfaceName() const
@@ -1613,22 +1618,29 @@ bool DOMWindow::dispatchEvent(PassRefPtrWillBeRawPtr<Event> prpEvent, PassRefPtr
return result;
}
-void DOMWindow::removeAllEventListeners()
+void DOMWindow::removeAllEventListenersInternal(BroadcastListenerRemoval mode)
{
EventTarget::removeAllEventListeners();
lifecycleNotifier().notifyRemoveAllEventListeners(this);
- if (m_frame && m_frame->host())
- m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this);
+ if (mode == DoBroadcastListenerRemoval) {
+ if (m_frame && m_frame->host())
+ m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this);
- if (Document* document = this->document())
- document->didClearTouchEventHandlers(document);
+ if (Document* document = this->document())
+ document->didClearTouchEventHandlers(document);
+ }
removeAllUnloadEventListeners(this);
removeAllBeforeUnloadEventListeners(this);
}
+void DOMWindow::removeAllEventListeners()
+{
+ removeAllEventListenersInternal(DoBroadcastListenerRemoval);
+}
+
void DOMWindow::finishedLoading()
{
if (m_shouldPrintWhenFinishedLoading) {
@@ -1875,6 +1887,7 @@ PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier()
void DOMWindow::trace(Visitor* visitor)
{
+ visitor->trace(m_document);
visitor->trace(m_screen);
visitor->trace(m_history);
visitor->trace(m_locationbar);
« no previous file with comments | « Source/core/frame/DOMWindow.h ('k') | Source/web/tests/ScrollingCoordinatorChromiumTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698