| Summary: | GraphicsLayer::removeAllChildren shouldn't be n^2 | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
| Component: | Compositing | Assignee: | Chris Dumez <cdumez> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | cdumez, simon.fraser, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
|
Description
Ahmad Saleem
2023-01-15 13:16:06 PST
This compiles:
void GraphicsLayer::removeAllChildren()
{
while (!m_children.isEmpty()) {
auto curLayer = m_children.last();
...
_______________
NOTE - It seems 'removeFromParent' calls 'removeFromParentInternal()' and it seems to be using 'removeFirstMatching' rather than 'reverseFind' but don't know how to amend this part.
void GraphicsLayer::removeFromParentInternal()
{
if (m_parent) {
GraphicsLayer* parent = m_parent;
setParent(nullptr);
parent->m_children.removeFirstMatching([this](auto& layer) {
return layer.ptr() == this;
});
// |this| may be destroyed here.
}
}
______________
Pull request: https://github.com/WebKit/WebKit/pull/18578 Committed 268814@main (106c4aae5f43): <https://commits.webkit.org/268814@main> Reviewed commits have been landed. Closing PR #18578 and removing active labels. |