| Summary: | Move disk operations when deleting cookies off from the main thread | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Alex Christensen <achristensen> | ||||
| Component: | WebKit Misc. | Assignee: | Alex Christensen <achristensen> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | cdumez, ews-watchlist, hi, japhet, joepeck, pangle, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
|
Description
Alex Christensen
2022-05-26 14:56:46 PDT
Created attachment 459795 [details]
Patch
Comment on attachment 459795 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=459795&action=review > Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm:155 > + [nsCookieStorage() setCookie:newCookie]; Isn't this doing a cookie storage operation on the main thread? > Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm:585 > + [nsCookieStorage() _saveCookies:makeBlockPtr([completionHandler = WTFMove(completionHandler)] () mutable { Isn't this doing cookie operations on the main thread? > Source/WebKit/NetworkProcess/Cookies/WebCookieManager.h:76 > + void deleteAllCookies(PAL::SessionID, CompletionHandler<void()>&&); I wish you'd use `CompletionHandler<void()>&&` consistently in your patch. However, you're using `CompletionHandler<void()>` as parameter sometimes. (In reply to Chris Dumez from comment #3) > Comment on attachment 459795 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=459795&action=review > > > Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm:155 > > + [nsCookieStorage() setCookie:newCookie]; > > Isn't this doing a cookie storage operation on the main thread? I think setting a cookie doesn't always immediately go to disk on the same thread. This patch only addresses cookie deleting on the main thread. > > Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm:585 > > + [nsCookieStorage() _saveCookies:makeBlockPtr([completionHandler = WTFMove(completionHandler)] () mutable { > > Isn't this doing cookie operations on the main thread? Ditto. > > Source/WebKit/NetworkProcess/Cookies/WebCookieManager.h:76 > > + void deleteAllCookies(PAL::SessionID, CompletionHandler<void()>&&); > > I wish you'd use `CompletionHandler<void()>&&` consistently in your patch. > However, you're using `CompletionHandler<void()>` as parameter sometimes. I'm trying to move to without && but there were places where it looked out of place. The two are functionally equivalent. (In reply to Alex Christensen from comment #4) > (In reply to Chris Dumez from comment #3) > > Comment on attachment 459795 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=459795&action=review > > > > > Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm:155 > > > + [nsCookieStorage() setCookie:newCookie]; > > > > Isn't this doing a cookie storage operation on the main thread? > I think setting a cookie doesn't always immediately go to disk on the same > thread. This patch only addresses cookie deleting on the main thread. > > > > Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm:585 > > > + [nsCookieStorage() _saveCookies:makeBlockPtr([completionHandler = WTFMove(completionHandler)] () mutable { > > > > Isn't this doing cookie operations on the main thread? > Ditto. > > > > Source/WebKit/NetworkProcess/Cookies/WebCookieManager.h:76 > > > + void deleteAllCookies(PAL::SessionID, CompletionHandler<void()>&&); > > > > I wish you'd use `CompletionHandler<void()>&&` consistently in your patch. > > However, you're using `CompletionHandler<void()>` as parameter sometimes. > I'm trying to move to without && but there were places where it looked out > of place. The two are functionally equivalent. CompletionHandler<void()>&& communicates to the caller that we want a r-value and they need to WTFMove(). CompletionHandler<void()> doesn't communicate that. It will give a build time error though if they fail to WTFMove() (only because CompletionHandler is not copyable). Comment on attachment 459795 [details]
Patch
GitHub PR has more &&
Committed r294947 (251055@main): <https://commits.webkit.org/251055@main> Reviewed commits have been landed. Closing PR #1072 and removing active labels. |