Bug 251772 - DocumentLoader should use std::unique_ptr<ServiceWorkerRegistrationData> rather than std::optional<>
Summary: DocumentLoader should use std::unique_ptr<ServiceWorkerRegistrationData> rath...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-02-05 20:41 PST by Simon Fraser (smfr)
Modified: 2023-02-24 10:57 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2023-02-05 20:41:28 PST
DocumentLoader wastes 352 + 7 bytes for the std::optional< ServiceWorkerRegistrationData> which is nullopt for most loads. We should heap-allocate ServiceWorkerRegistrationData.

Also, in ServiceWorkerRegistrationData, is scopeURL the same as key.scope()? Do we need to store the URL twice?
Comment 1 youenn fablet 2023-02-06 01:43:21 PST
(In reply to Simon Fraser (smfr) from comment #0)
> DocumentLoader wastes 352 + 7 bytes for the std::optional<
> ServiceWorkerRegistrationData> which is nullopt for most loads. We should
> heap-allocate ServiceWorkerRegistrationData.

Sounds good.

> Also, in ServiceWorkerRegistrationData, is scopeURL the same as key.scope()?

Almost, minor the fragment identifier.

> Do we need to store the URL twice?

We could probably just store the fragment identifier in ServiceWorkerRegistrationData. which is often null.
Comment 2 Radar WebKit Bug Importer 2023-02-06 02:04:43 PST
<rdar://problem/105074302>
Comment 3 youenn fablet 2023-02-06 03:54:08 PST
Pull request: https://github.com/WebKit/WebKit/pull/9682
Comment 4 EWS 2023-02-07 13:11:55 PST
Committed 259977@main (f0228a3f07df): <https://commits.webkit.org/259977@main>

Reviewed commits have been landed. Closing PR #9682 and removing active labels.
Comment 5 EWS 2023-02-24 10:57:43 PST
Committed 259548.294@safari-7615-branch (3e295cf38bde): <https://commits.webkit.org/259548.294@safari-7615-branch>

Reviewed commits have been landed. Closing PR #417 and removing active labels.