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

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

Issue 881683003: Issue FrameDestructionObserver::frameDestroyed() notification on detach. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: weak references no longer needed Created 5 years, 10 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.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/LocalFrame.cpp
diff --git a/Source/core/frame/LocalFrame.cpp b/Source/core/frame/LocalFrame.cpp
index 09e5bda9a8322fe3a6d9ed1d5e5a51fc90aecc50..ab088f9515fbb1b458b1ea8354492de93743d3d7 100644
--- a/Source/core/frame/LocalFrame.cpp
+++ b/Source/core/frame/LocalFrame.cpp
@@ -204,19 +204,10 @@ LocalFrame::~LocalFrame()
// Verify that the FrameView has been cleared as part of detaching
// the frame owner.
ASSERT(!m_view);
-
#if !ENABLE(OILPAN)
// Oilpan: see setDOMWindow() comment why it is acceptable not to
- // mirror the non-Oilpan call below.
- //
- // Also, FrameDestructionObservers that live longer than this
- // frame object keep weak references to the frame; those will be
- // automatically cleared by the garbage collector. Hence, explicit
- // frameDestroyed() notifications aren't needed.
+ // explicitly call setDOMWindow() here.
setDOMWindow(nullptr);
-
- for (const auto& frameDestructionObserver : m_destructionObservers)
- frameDestructionObserver->frameDestroyed();
#endif
}
@@ -281,6 +272,7 @@ void LocalFrame::detach()
m_loader.stopAllLoaders();
if (!client())
return;
+
m_loader.detach();
// Notify ScriptController that the frame is closing, since its cleanup ends up calling
// back to FrameLoaderClient via WindowProxy.
@@ -294,6 +286,14 @@ void LocalFrame::detach()
// finalization. Too late to access various heap objects at that
// stage.
m_loader.clear();
+
+ // Signal frame destruction here rather than in the destructor.
+ // Main motivation is to avoid being dependent on its exact timing (Oilpan.)
+ for (const auto& frameDestructionObserver : m_destructionObservers)
+ frameDestructionObserver->frameDestroyed();
+
+ m_destructionObservers.clear();
+ m_supplements.clear();
}
SecurityContext* LocalFrame::securityContext() const
« no previous file with comments | « Source/core/frame/LocalDOMWindow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698