Bug 228119 - Completion handler of NetworkProcess::prepareToSuspend may not be invoked promptly
Summary: Completion handler of NetworkProcess::prepareToSuspend may not be invoked pro...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sihui Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-07-20 12:16 PDT by Sihui Liu
Modified: 2021-07-20 16:09 PDT (History)
2 users (show)

See Also:


Attachments
Patch (12.67 KB, patch)
2021-07-20 12:31 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (12.61 KB, patch)
2021-07-20 14:36 PDT, 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 2021-07-20 12:16:24 PDT
...
Comment 1 Sihui Liu 2021-07-20 12:31:22 PDT
Created attachment 433891 [details]
Patch
Comment 2 Chris Dumez 2021-07-20 12:49:25 PDT
Comment on attachment 433891 [details]
Patch

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

> Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:1455
> +    sharedStatisticsQueue()->dispatch([suspensionIdentifier = globalSuspensionIdentifier, completionHandler = WTFMove(completionHandler)] () mutable {

Could use `suspensionIdentifier = ++globalSuspensionIdentifier`, and then you wouldn't need the `++globalSuspensionIdentifier;` line above.

> Source/WebKit/NetworkProcess/NetworkProcess.cpp:2227
> +    RunLoop::main().dispatchAfter(5_s, [this, weakThis = makeWeakPtr(*this), suspensionIdentifier = m_suspensionIdentifier] {

ditto.

> Source/WebKit/NetworkProcess/WebStorage/StorageManagerSet.cpp:184
> +    m_queue->dispatch([this, protectedThis = makeRef(*this), suspensionIdentifier = m_suspensionIdentifier, completionHandler = WTFMove(completionHandler)] () mutable {

ditto.

> Source/WebKit/NetworkProcess/WebStorage/StorageManagerSet.h:106
> +    uint64_t m_suspensionIdentifier  WTF_GUARDED_BY_LOCK(m_suspensionLock) { 0 };

nit: extra space.
Comment 3 Sihui Liu 2021-07-20 14:36:26 PDT
Created attachment 433901 [details]
Patch
Comment 4 EWS 2021-07-20 16:08:34 PDT
Committed r280110 (239827@main): <https://commits.webkit.org/239827@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 433901 [details].
Comment 5 Radar WebKit Bug Importer 2021-07-20 16:09:27 PDT
<rdar://problem/80864282>