Bug 236029 - Remove OriginStorageManager if it's not in use
Summary: Remove OriginStorageManager if it's not in use
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sihui Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-02 10:38 PST by Sihui Liu
Modified: 2022-02-02 16:11 PST (History)
4 users (show)

See Also:


Attachments
Patch (5.66 KB, patch)
2022-02-02 10:47 PST, Sihui Liu
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (5.66 KB, patch)
2022-02-02 11:29 PST, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch for landing (5.47 KB, patch)
2022-02-02 15:29 PST, Sihui Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>