Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0c9f895d724ddd4bad87fcb10cc596c1b83e2ec8
https://github.com/WebKit/WebKit/commit/0c9f895d724ddd4bad87fcb10cc596c1b83e2ec8
Author: Nathan Solomon <[email protected]>
Date: 2026-04-13 (Mon, 13 Apr 2026)
Changed paths:
M Source/WebCore/dom/Document.cpp
M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayBox.h
M
Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContent.cpp
M Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContent.h
M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp
M Source/WebCore/page/LocalFrameViewLayoutContext.cpp
M Source/WebCore/page/LocalFrameViewLayoutContext.h
M Source/WebCore/page/MemoryRelease.cpp
M Source/WebCore/page/Page.cpp
Log Message:
-----------
Defer InlineContent destruction to opportunistic task scheduler
https://bugs.webkit.org/show_bug.cgi?id=311748
rdar://173186053
Reviewed by Alan Baradlay.
When LineLayout is destroyed, it synchronously destroys InlineContent,
which is shown on profiles to be one of the largest contributors of work to the
render tree
teardown time.
Defer InlineContent destruction to the opportunistic task scheduler.
In the LineLayout destructor, instead of destroying InlineContent
synchronously, sever its references to objects with shorter
lifetimes and move InlineContent to a deferred list on
LocalFrameViewLayoutContext.
This list is then managed by opportunistic task scheduler to opportunistically
delete
the InlineContents.
A/B testing shows this is a small performance gain.
No new tests because there should be no change in behavior. This PR
just changes when InlineContent deletion occurs.
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::destroyRenderTree):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayBox.h:
(WebCore::InlineDisplay::Box::layoutBox const):
(WebCore::InlineDisplay::Box::detachLayoutBox):
(WebCore::InlineDisplay::Box::Box):
* Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContent.cpp:
(WebCore::LayoutIntegration::InlineContent::InlineContent):
(WebCore::LayoutIntegration::InlineContent::formattingContextRoot const):
(WebCore::LayoutIntegration::InlineContent::clearFormattingContextRoot):
* Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContent.h:
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::~LineLayout):
* Source/WebCore/page/LocalFrameViewLayoutContext.cpp:
(WebCore::LocalFrameViewLayoutContext::DetachedRendererList::append):
(WebCore::LocalFrameViewLayoutContext::DetachedInlineContentList::append):
(WebCore::LocalFrameViewLayoutContext::DetachedInlineContentList::clear):
(WebCore::LocalFrameViewLayoutContext::detachInlineContent const):
(WebCore::LocalFrameViewLayoutContext::deleteDetachedInlineContentNow const):
* Source/WebCore/page/LocalFrameViewLayoutContext.h:
* Source/WebCore/page/MemoryRelease.cpp:
(WebCore::releaseNoncriticalMemory):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::deleteRemovedNodesAndDetachedRenderers):
Canonical link: https://commits.webkit.org/311134@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications