Commit 6375bc1a authored by dcheng@chromium.org's avatar dcheng@chromium.org

Remove redundant calls to FrameLoader::frameDetached().

Page::willBeDestroyed() detachs any frames remaining in the frame tree,
so there's no need to do this before calling willBeDestroyed().

In addition, since frameDetached() recursively detaches all frames,
eliminate the loop inside Page::willBeDestroyed() to detach all frames.

Review URL: https://codereview.chromium.org/339493002

git-svn-id: svn://svn.chromium.org/blink/trunk@176173 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 28d0c7a7
......@@ -774,9 +774,6 @@ bool InspectorOverlay::getBoxModel(Node* node, Vector<FloatQuad>* quads)
void InspectorOverlay::freePage()
{
if (m_overlayPage) {
// FIXME: This logic is duplicated in SVGImage and WebViewImpl. Perhaps it can be combined
// into Page's destructor.
toLocalFrame(m_overlayPage->mainFrame())->loader().frameDetached();
m_overlayPage->willBeDestroyed();
m_overlayPage.clear();
}
......
......@@ -601,6 +601,9 @@ void Page::trace(Visitor* visitor)
void Page::willBeDestroyed()
{
if (m_mainFrame && m_mainFrame->isLocalFrame())
deprecatedLocalMainFrame()->loader().frameDetached();
// Disable all agents prior to resetting the frame view.
m_inspectorController->willBeDestroyed();
......@@ -615,11 +618,6 @@ void Page::willBeDestroyed()
if (ordinaryPages().contains(this))
ordinaryPages().remove(this);
for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
if (frame->isLocalFrame())
toLocalFrame(frame)->loader().frameDetached();
}
if (m_scrollingCoordinator)
m_scrollingCoordinator->willBeDestroyed();
......
......@@ -66,7 +66,7 @@ SVGImage::~SVGImage()
if (m_page) {
// Store m_page in a local variable, clearing m_page, so that SVGImageChromeClient knows we're destructed.
OwnPtrWillBeRawPtr<Page> currentPage = m_page.release();
toLocalFrame(currentPage->mainFrame())->loader().frameDetached(); // Break both the loader and view references to the frame
// Break both the loader and view references to the frame
currentPage->willBeDestroyed();
}
......
......@@ -238,9 +238,6 @@ void WebPagePopupImpl::destroyPage()
if (!m_page)
return;
if (m_page->mainFrame())
toLocalFrame(m_page->mainFrame())->loader().frameDetached();
m_page->willBeDestroyed();
m_page.clear();
}
......
......@@ -1540,11 +1540,6 @@ void WebViewImpl::close()
if (m_page) {
// Initiate shutdown for the entire frameset. This will cause a lot of
// notifications to be sent.
// FIXME: This is redundant with willBeDestroyed()... is this really
// needed?
if (m_page->mainFrame()->isLocalFrame())
m_page->deprecatedLocalMainFrame()->loader().frameDetached();
m_page->willBeDestroyed();
m_page.clear();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment