Bug 236029

Summary: Remove OriginStorageManager if it's not in use
Product: WebKit Reporter: Sihui Liu <sihui_liu>
Component: New BugsAssignee: Sihui Liu <sihui_liu>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, darin, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
none
Patch for landing none

Description Sihui Liu 2022-02-02 10:38:41 PST
...
Comment 1 Sihui Liu 2022-02-02 10:47:57 PST
Created attachment 450674 [details]
Patch
Comment 2 Sihui Liu 2022-02-02 11:29:55 PST
Created attachment 450679 [details]
Patch
Comment 3 Darin Adler 2022-02-02 13:53:00 PST
Comment on attachment 450679 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=450679&action=review

> Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp:181
> +        HashSet<WebCore::ClientOrigin> originsToRemove;
> +        for (auto& [origin, manager] : m_localOriginStorageManagers) {
> +            manager->connectionClosed(connection);
> +            if (!manager->isActive())
> +                originsToRemove.add(origin);
> +        }
> +
> +        for (auto origin : originsToRemove)
> +            m_localOriginStorageManagers.remove(origin);

HashSet has a removeIf function that can do this sort of thing much more efficiently. We should use it here.
Comment 4 Sihui Liu 2022-02-02 15:29:35 PST
Created attachment 450705 [details]
Patch for landing
Comment 5 EWS 2022-02-02 16:10:33 PST
Committed r289012 (246721@main): <https://commits.webkit.org/246721@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450705 [details].
Comment 6 Radar WebKit Bug Importer 2022-02-02 16:11:18 PST
<rdar://problem/88406602>