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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 2142753002: Remove LocalFrameLifecycleObserver::willDetachFrameHost() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: temp Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // Clear FrameScheduler again in case it is recreated in scripting. 397 // Clear FrameScheduler again in case it is recreated in scripting.
398 m_frameScheduler.reset(); 398 m_frameScheduler.reset();
399 if (!client()) 399 if (!client())
400 return; 400 return;
401 401
402 client()->willBeDetached(); 402 client()->willBeDetached();
403 // Notify ScriptController that the frame is closing, since its cleanup ends up calling 403 // Notify ScriptController that the frame is closing, since its cleanup ends up calling
404 // back to FrameLoaderClient via WindowProxy. 404 // back to FrameLoaderClient via WindowProxy.
405 script().clearForClose(); 405 script().clearForClose();
406 setView(nullptr); 406 setView(nullptr);
407 willDetachFrameHost(); 407
408 InspectorInstrumentation::frameDetachedFromParent(this); 408 m_host->eventHandlerRegistry().didRemoveAllEventHandlers(*localDOMWindow());
409 Frame::detach(type);
410 409
411 // Signal frame destruction here rather than in the destructor. 410 // Signal frame destruction here rather than in the destructor.
412 // Main motivation is to avoid being dependent on its exact timing (Oilpan.) 411 // Main motivation is to avoid being dependent on its exact timing (Oilpan.)
413 LocalFrameLifecycleNotifier::notifyContextDestroyed(); 412 LocalFrameLifecycleNotifier::notifyContextDestroyed();
413
414 // TODO: Page should take care of updating focus/scrolling instead of Frame.
415 // TODO: It's unclear as to why this is called more than once, but it is,
416 // so page() could be null.
417 if (page() && page()->focusController().focusedFrame() == this)
418 page()->focusController().setFocusedFrame(nullptr);
419
420 if (page() && page()->scrollingCoordinator() && m_view)
421 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get());
422
423 InspectorInstrumentation::frameDetachedFromParent(this);
424 Frame::detach(type);
425
414 m_supplements.clear(); 426 m_supplements.clear();
415 WeakIdentifierMap<LocalFrame>::notifyObjectDestroyed(this); 427 WeakIdentifierMap<LocalFrame>::notifyObjectDestroyed(this);
416 } 428 }
417 429
418 bool LocalFrame::prepareForCommit() 430 bool LocalFrame::prepareForCommit()
419 { 431 {
420 return loader().prepareForCommit(); 432 return loader().prepareForCommit();
421 } 433 }
422 434
423 SecurityContext* LocalFrame::securityContext() const 435 SecurityContext* LocalFrame::securityContext() const
(...skipping 16 matching lines...) Expand all
440 return m_script->getWindowProxyManager(); 452 return m_script->getWindowProxyManager();
441 } 453 }
442 454
443 bool LocalFrame::shouldClose() 455 bool LocalFrame::shouldClose()
444 { 456 {
445 // TODO(dcheng): This should be fixed to dispatch beforeunload events to 457 // TODO(dcheng): This should be fixed to dispatch beforeunload events to
446 // both local and remote frames. 458 // both local and remote frames.
447 return m_loader.shouldClose(); 459 return m_loader.shouldClose();
448 } 460 }
449 461
450 void LocalFrame::willDetachFrameHost()
451 {
452 LocalFrameLifecycleNotifier::notifyWillDetachFrameHost();
453
454 // FIXME: Page should take care of updating focus/scrolling instead of Frame .
455 // FIXME: It's unclear as to why this is called more than once, but it is,
456 // so page() could be null.
457 if (page() && page()->focusController().focusedFrame() == this)
458 page()->focusController().setFocusedFrame(nullptr);
459
460 if (page() && page()->scrollingCoordinator() && m_view)
461 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get());
462 }
463
464 void LocalFrame::setDOMWindow(LocalDOMWindow* domWindow) 462 void LocalFrame::setDOMWindow(LocalDOMWindow* domWindow)
465 { 463 {
466 // Oilpan: setDOMWindow() cannot be used when finalizing. Which 464 // Oilpan: setDOMWindow() cannot be used when finalizing. Which
467 // is acceptable as its actions are either not needed or handled 465 // is acceptable as its actions are either not needed or handled
468 // by other means -- 466 // by other means --
469 // 467 //
470 // - LocalFrameLifecycleObserver::willDetachFrameHost() will have 468 // - LocalFrameLifecycleObserver::willDetachFrameHost() will have
471 // signalled the Inspector frameWindowDiscarded() notifications. 469 // signalled the Inspector frameWindowDiscarded() notifications.
472 // We assume that all LocalFrames are detached, where that notification 470 // We assume that all LocalFrames are detached, where that notification
473 // will have been done. 471 // will have been done.
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 m_frame->client()->frameBlameContext()->Enter(); 864 m_frame->client()->frameBlameContext()->Enter();
867 } 865 }
868 866
869 ScopedFrameBlamer::~ScopedFrameBlamer() 867 ScopedFrameBlamer::~ScopedFrameBlamer()
870 { 868 {
871 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 869 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
872 m_frame->client()->frameBlameContext()->Leave(); 870 m_frame->client()->frameBlameContext()->Leave();
873 } 871 }
874 872
875 } // namespace blink 873 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.h ('k') | third_party/WebKit/Source/core/frame/LocalFrameLifecycleNotifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698