void Page::willBeDestroyed() { RefPtr<Frame> mainFrame = m_mainFrame; if (mainFrame->isLocalFrame()) toLocalFrame(mainFrame.get())->loader().frameDetached(); // Disable all agents prior to resetting the frame view. m_inspectorController->willBeDestroyed(); if (mainFrame->isLocalFrame()) { toLocalFrame(mainFrame.get())->setView(nullptr); } else { ASSERT(m_mainFrame->isRemoteFrame()); toRemoteFrame(mainFrame.get())->setView(nullptr); } allPages().remove(this); if (ordinaryPages().contains(this)) ordinaryPages().remove(this); if (m_scrollingCoordinator) m_scrollingCoordinator->willBeDestroyed(); #ifndef NDEBUG pageCounter.decrement(); #endif m_chrome->willBeDestroyed(); m_mainFrame = 0; if (m_validationMessageClient) m_validationMessageClient->willBeDestroyed(); WillBeHeapSupplementable<Page>::willBeDestroyed(); }
WebFrame* WebFrame::fromFrame(Frame* frame) { if (!frame) return 0; if (frame->isLocalFrame()) return WebLocalFrameImpl::fromFrame(toLocalFrame(*frame)); return WebRemoteFrameImpl::fromFrame(toRemoteFrame(*frame)); }
FrameTree::~FrameTree() { // FIXME: Why is this here? Doesn't this parallel what we already do in ~LocalFrame? for (Frame* child = firstChild(); child; child = child->tree().nextSibling()) { if (child->isLocalFrame()) toLocalFrame(child)->setView(nullptr); else if (child->isRemoteFrame()) toRemoteFrame(child)->setView(nullptr); } }