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

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

Issue 2172153002: Move FrameLoader completion check timer to loading task runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't lazy create the frame scheduler Created 4 years, 4 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 void LocalFrame::detach(FrameDetachType type) 373 void LocalFrame::detach(FrameDetachType type)
374 { 374 {
375 PluginScriptForbiddenScope forbidPluginDestructorScripting; 375 PluginScriptForbiddenScope forbidPluginDestructorScripting;
376 m_loader.stopAllLoaders(); 376 m_loader.stopAllLoaders();
377 // Don't allow any new child frames to load in this frame: attaching a new 377 // Don't allow any new child frames to load in this frame: attaching a new
378 // child frame during or after detaching children results in an attached 378 // child frame during or after detaching children results in an attached
379 // frame on a detached DOM tree, which is bad. 379 // frame on a detached DOM tree, which is bad.
380 SubframeLoadingDisabler disabler(*document()); 380 SubframeLoadingDisabler disabler(*document());
381 m_loader.dispatchUnloadEvent(); 381 m_loader.dispatchUnloadEvent();
382 detachChildren(); 382 detachChildren();
383 m_frameScheduler.reset();
384 383
385 // All done if detaching the subframes brought about a detach of this frame also. 384 // All done if detaching the subframes brought about a detach of this frame also.
386 if (!client()) 385 if (!client())
387 return; 386 return;
388 387
389 // stopAllLoaders() needs to be called after detachChildren(), because detac hChildren() 388 // stopAllLoaders() needs to be called after detachChildren(), because detac hChildren()
390 // will trigger the unload event handlers of any child frames, and those eve nt 389 // will trigger the unload event handlers of any child frames, and those eve nt
391 // handlers might start a new subresource load in this frame. 390 // handlers might start a new subresource load in this frame.
392 m_loader.stopAllLoaders(); 391 m_loader.stopAllLoaders();
393 m_loader.detach(); 392 m_loader.detach();
394 document()->detachLayoutTree(); 393 document()->detachLayoutTree();
395 // This is the earliest that scripting can be disabled: 394 // This is the earliest that scripting can be disabled:
396 // - FrameLoader::detach() can fire XHR abort events 395 // - FrameLoader::detach() can fire XHR abort events
397 // - Document::detachLayoutTree()'s deferred widget updates can run script. 396 // - Document::detachLayoutTree()'s deferred widget updates can run script.
398 ScriptForbiddenScope forbidScript; 397 ScriptForbiddenScope forbidScript;
399 m_loader.clear(); 398 m_loader.clear();
400 // Clear FrameScheduler again in case it is recreated in scripting.
401 m_frameScheduler.reset();
402 if (!client()) 399 if (!client())
403 return; 400 return;
404 401
405 client()->willBeDetached(); 402 client()->willBeDetached();
406 // 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
407 // back to FrameLoaderClient via WindowProxy. 404 // back to FrameLoaderClient via WindowProxy.
408 script().clearForClose(); 405 script().clearForClose();
409 setView(nullptr); 406 setView(nullptr);
410 407
411 m_host->eventHandlerRegistry().didRemoveAllEventHandlers(*localDOMWindow()); 408 m_host->eventHandlerRegistry().didRemoveAllEventHandlers(*localDOMWindow());
412 409
413 // Signal frame destruction here rather than in the destructor. 410 // Signal frame destruction here rather than in the destructor.
414 // 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.)
415 LocalFrameLifecycleNotifier::notifyContextDestroyed(); 412 LocalFrameLifecycleNotifier::notifyContextDestroyed();
416 413
417 // TODO: Page should take care of updating focus/scrolling instead of Frame. 414 // TODO: Page should take care of updating focus/scrolling instead of Frame.
418 // TODO: It's unclear as to why this is called more than once, but it is, 415 // TODO: It's unclear as to why this is called more than once, but it is,
419 // so page() could be null. 416 // so page() could be null.
420 if (page() && page()->focusController().focusedFrame() == this) 417 if (page() && page()->focusController().focusedFrame() == this)
421 page()->focusController().setFocusedFrame(nullptr); 418 page()->focusController().setFocusedFrame(nullptr);
422 419
423 if (page() && page()->scrollingCoordinator() && m_view) 420 if (page() && page()->scrollingCoordinator() && m_view)
424 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); 421 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get());
425 422
426 InspectorInstrumentation::frameDetachedFromParent(this); 423 InspectorInstrumentation::frameDetachedFromParent(this);
427 Frame::detach(type); 424 Frame::detach(type);
428 425
429 m_supplements.clear(); 426 m_supplements.clear();
427 m_frameScheduler.reset();
430 WeakIdentifierMap<LocalFrame>::notifyObjectDestroyed(this); 428 WeakIdentifierMap<LocalFrame>::notifyObjectDestroyed(this);
431 } 429 }
432 430
433 bool LocalFrame::prepareForCommit() 431 bool LocalFrame::prepareForCommit()
434 { 432 {
435 return loader().prepareForCommit(); 433 return loader().prepareForCommit();
436 } 434 }
437 435
438 SecurityContext* LocalFrame::securityContext() const 436 SecurityContext* LocalFrame::securityContext() const
439 { 437 {
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 return layerTree ? layerTree->toPrettyJSONString() : String(); 797 return layerTree ? layerTree->toPrettyJSONString() : String();
800 } 798 }
801 799
802 bool LocalFrame::shouldThrottleRendering() const 800 bool LocalFrame::shouldThrottleRendering() const
803 { 801 {
804 return view() && view()->shouldThrottleRendering(); 802 return view() && view()->shouldThrottleRendering();
805 } 803 }
806 804
807 inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO wner* owner, ServiceRegistry* serviceRegistry) 805 inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO wner* owner, ServiceRegistry* serviceRegistry)
808 : Frame(client, host, owner) 806 : Frame(client, host, owner)
807 , m_frameScheduler(page()->chromeClient().createFrameScheduler(client->frame BlameContext()))
809 , m_loader(this) 808 , m_loader(this)
810 , m_navigationScheduler(NavigationScheduler::create(this)) 809 , m_navigationScheduler(NavigationScheduler::create(this))
811 , m_script(ScriptController::create(this)) 810 , m_script(ScriptController::create(this))
812 , m_editor(Editor::create(*this)) 811 , m_editor(Editor::create(*this))
813 , m_spellChecker(SpellChecker::create(*this)) 812 , m_spellChecker(SpellChecker::create(*this))
814 , m_selection(FrameSelection::create(this)) 813 , m_selection(FrameSelection::create(this))
815 , m_eventHandler(new EventHandler(this)) 814 , m_eventHandler(new EventHandler(this))
816 , m_console(FrameConsole::create(*this)) 815 , m_console(FrameConsole::create(*this))
817 , m_inputMethodController(InputMethodController::create(*this)) 816 , m_inputMethodController(InputMethodController::create(*this))
818 , m_navigationDisableCount(0) 817 , m_navigationDisableCount(0)
819 , m_pageZoomFactor(parentPageZoomFactor(this)) 818 , m_pageZoomFactor(parentPageZoomFactor(this))
820 , m_textZoomFactor(parentTextZoomFactor(this)) 819 , m_textZoomFactor(parentTextZoomFactor(this))
821 , m_inViewSourceMode(false) 820 , m_inViewSourceMode(false)
822 , m_serviceRegistry(serviceRegistry) 821 , m_serviceRegistry(serviceRegistry)
823 { 822 {
824 if (isLocalRoot()) 823 if (isLocalRoot())
825 m_instrumentingAgents = new InstrumentingAgents(); 824 m_instrumentingAgents = new InstrumentingAgents();
826 else 825 else
827 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 826 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
828 } 827 }
829 828
830 WebFrameScheduler* LocalFrame::frameScheduler() 829 WebFrameScheduler* LocalFrame::frameScheduler()
831 { 830 {
832 if (!m_frameScheduler.get())
833 m_frameScheduler = page()->chromeClient().createFrameScheduler(client()- >frameBlameContext());
834
835 ASSERT(m_frameScheduler.get());
836 return m_frameScheduler.get(); 831 return m_frameScheduler.get();
837 } 832 }
838 833
839 void LocalFrame::scheduleVisualUpdateUnlessThrottled() 834 void LocalFrame::scheduleVisualUpdateUnlessThrottled()
840 { 835 {
841 if (shouldThrottleRendering()) 836 if (shouldThrottleRendering())
842 return; 837 return;
843 page()->animator().scheduleVisualUpdate(this); 838 page()->animator().scheduleVisualUpdate(this);
844 } 839 }
845 840
(...skipping 29 matching lines...) Expand all
875 m_frame->client()->frameBlameContext()->Enter(); 870 m_frame->client()->frameBlameContext()->Enter();
876 } 871 }
877 872
878 ScopedFrameBlamer::~ScopedFrameBlamer() 873 ScopedFrameBlamer::~ScopedFrameBlamer()
879 { 874 {
880 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 875 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
881 m_frame->client()->frameBlameContext()->Leave(); 876 m_frame->client()->frameBlameContext()->Leave();
882 } 877 }
883 878
884 } // namespace blink 879 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.h ('k') | third_party/WebKit/Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698