[Webkit-unassigned] [Bug 250654] GraphicsLayer::removeAllChildren shouldn't be n^2

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jul 24 13:19:34 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=250654

Ahmad Saleem <ahmad.saleem792 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cdumez at apple.com

--- Comment #2 from Ahmad Saleem <ahmad.saleem792 at gmail.com> ---
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.
    }
}

______________

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230724/78073b95/attachment.htm>


More information about the webkit-unassigned mailing list