Changeset 251924 in webkit
- Timestamp:
- Nov 1, 2019 10:04:36 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r251920 r251924 1 2019-11-01 Ryosuke Niwa <rniwa@webkit.org> 2 3 Don't leak documents with a pending requestIdleCallback 4 https://bugs.webkit.org/show_bug.cgi?id=203708 5 6 Reviewed by Simon Fraser. 7 8 Added a test for removing iframes with a pending idle callback and test that 9 the current documents of those iframes are collected immediately by GCController.collect. 10 11 * requestidlecallback/requestidlecallback-document-gc-expected.txt: Added. 12 * requestidlecallback/requestidlecallback-document-gc.html: Added. 13 1 14 2019-11-01 Peng Liu <peng.liu6@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r251920 r251924 1 2019-11-01 Ryosuke Niwa <rniwa@webkit.org> 2 3 Don't leak documents with a pending requestIdleCallback 4 https://bugs.webkit.org/show_bug.cgi?id=203708 5 6 Reviewed by Simon Fraser. 7 8 Remove all tasks associated with a stopped document right away instead of waiting for 9 WindowEventLoop::run to execute so that even when author scripts synchronously add and remove 10 multiple documents, we don't end up leaking all of them until we yield to the run loop. 11 12 Also moved the code to suspend & resume event loops from CachedFrame to Document's 13 ActiveDOMObjects related functions for consistency. 14 15 Test: requestidlecallback/requestidlecallback-document-gc.html 16 17 * dom/Document.cpp: 18 (WebCore::Document::suspendActiveDOMObjects): Moved the code from CachedFrameBase::restore. 19 (WebCore::Document::resumeActiveDOMObjects): Ditto from CachedFrame. 20 (WebCore::Document::stopActiveDOMObjects): Remove all tasks associated with this document. 21 * dom/Document.h: 22 (WebCore::Document::eventLoopIfExists): Deleted. 23 * dom/WindowEventLoop.cpp: 24 (WebCore::WindowEventLoop::stop): 25 (WebCore::WindowEventLoop::run): 26 * dom/WindowEventLoop.h: 27 * history/CachedFrame.cpp: 28 (WebCore::CachedFrameBase::restore): 29 (WebCore::CachedFrame::CachedFrame): 30 1 31 2019-11-01 Peng Liu <peng.liu6@apple.com> 2 32 -
trunk/Source/WebCore/dom/Document.cpp
r251867 r251924 2636 2636 void Document::suspendActiveDOMObjects(ReasonForSuspension why) 2637 2637 { 2638 if (m_eventLoop) 2639 m_eventLoop->suspend(*this); 2638 2640 ScriptExecutionContext::suspendActiveDOMObjects(why); 2639 2641 suspendDeviceMotionAndOrientationUpdates(); … … 2643 2645 void Document::resumeActiveDOMObjects(ReasonForSuspension why) 2644 2646 { 2647 if (m_eventLoop) 2648 m_eventLoop->resume(*this); 2645 2649 ScriptExecutionContext::resumeActiveDOMObjects(why); 2646 2650 resumeDeviceMotionAndOrientationUpdates(); … … 2650 2654 void Document::stopActiveDOMObjects() 2651 2655 { 2656 if (m_eventLoop) 2657 m_eventLoop->stop(*this); 2652 2658 ScriptExecutionContext::stopActiveDOMObjects(); 2653 2659 platformSuspendOrStopActiveDOMObjects(); -
trunk/Source/WebCore/dom/Document.h
r251867 r251924 1064 1064 1065 1065 AbstractEventLoop& eventLoop() final; 1066 WindowEventLoop* eventLoopIfExists() { return m_eventLoop.get(); }1067 1066 1068 1067 ScriptedAnimationController* scriptedAnimationController() { return m_scriptedAnimationController.get(); } -
trunk/Source/WebCore/dom/WindowEventLoop.cpp
r251792 r251924 57 57 } 58 58 59 void WindowEventLoop::stop(Document& document) 60 { 61 m_tasks.removeAllMatching([identifier = document.identifier()] (auto& task) { 62 return task.documentIdentifier == identifier; 63 }); 64 } 65 59 66 void WindowEventLoop::scheduleToRunIfNeeded() 60 67 { … … 71 78 void WindowEventLoop::run() 72 79 { 80 if (m_tasks.isEmpty()) 81 return; 82 73 83 Vector<Task> tasks = WTFMove(m_tasks); 74 84 m_documentIdentifiersForSuspendedTasks.clear(); -
trunk/Source/WebCore/dom/WindowEventLoop.h
r251792 r251924 43 43 void suspend(Document&); 44 44 void resume(Document&); 45 void stop(Document&); 45 46 46 47 private: -
trunk/Source/WebCore/history/CachedFrame.cpp
r251258 r251924 108 108 m_document->accessSVGExtensions().unpauseAnimations(); 109 109 110 if (auto* eventLoop = m_document->eventLoopIfExists())111 eventLoop->resume(*m_document);112 113 110 m_document->resume(ReasonForSuspension::BackForwardCache); 114 111 … … 176 173 m_document->suspend(ReasonForSuspension::BackForwardCache); 177 174 178 if (auto* eventLoop = m_document->eventLoopIfExists())179 eventLoop->suspend(*m_document);180 181 175 m_cachedFrameScriptData = makeUnique<ScriptCachedFrameData>(frame); 182 176
Note: See TracChangeset
for help on using the changeset viewer.