Bug 234366

Summary: Move WebIDBServers from NetworkProcess to NetworkSession class
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, berto, cgarcia, darin, ews-watchlist, galpeter, ggaren, gustavo, kkinnunen, mkwst, sam, sihui_liu, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=234179
https://bugs.webkit.org/show_bug.cgi?id=234409
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
none
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch none

Description Chris Dumez 2021-12-15 14:20:57 PST
Move WebIDBServers from NetworkProcess to NetworkSession class, since they are per session.
Comment 1 Chris Dumez 2021-12-15 14:23:19 PST
Created attachment 447284 [details]
Patch
Comment 2 Chris Dumez 2021-12-15 14:39:42 PST
Created attachment 447286 [details]
Patch
Comment 3 Chris Dumez 2021-12-15 15:10:47 PST
Created attachment 447288 [details]
Patch
Comment 4 Chris Dumez 2021-12-15 15:34:32 PST
Created attachment 447292 [details]
Patch
Comment 5 Darin Adler 2021-12-15 17:47:27 PST
Comment on attachment 447292 [details]
Patch

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

Looks like a good, relatively straightforward refactoring. I didn’t spot anything obviously missing.

> Source/WebKit/NetworkProcess/NetworkProcess.cpp:393
> +    if (auto* networkSession = this->networkSession(sessionID))
> +        networkSession->ensureWebIDBServer().addConnection(connection.connection(), identifier);

Tempting to just use "session" to avoid the need for "this->" and possibly make things even more readable. Other cases of that below.

> Source/WebKit/NetworkProcess/NetworkProcess.cpp:1847
> +            auto* session = this->networkSession(sessionID);

Not sure we need the "this->" here since there is no name collision.

> Source/WebKit/NetworkProcess/NetworkSession.cpp:677
> +    // *********
> +    // IMPORTANT: Do not change the directory structure for indexed databases on disk without first consulting a reviewer from Apple (<rdar://problem/17454712>)
> +    // *********

This is clearly a valuable comment. But is this function the absolute best place for it?

> Source/WebKit/NetworkProcess/ios/NetworkProcessIOS.mm:120
> +        forEachNetworkSession([](auto& networkSession) {

Formatting tweak: can’t remember if we use spaces here.
Cod style tweak: Always love the single words when the scope is small enough, so just "session" would be nice.
Comment 6 Chris Dumez 2021-12-16 07:15:09 PST
(In reply to Darin Adler from comment #5)
> Comment on attachment 447292 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=447292&action=review
> 
> Looks like a good, relatively straightforward refactoring. I didn’t spot
> anything obviously missing.
> 
> > Source/WebKit/NetworkProcess/NetworkProcess.cpp:393
> > +    if (auto* networkSession = this->networkSession(sessionID))
> > +        networkSession->ensureWebIDBServer().addConnection(connection.connection(), identifier);
> 
> Tempting to just use "session" to avoid the need for "this->" and possibly
> make things even more readable. Other cases of that below.

Will fix.

> > Source/WebKit/NetworkProcess/NetworkProcess.cpp:1847
> > +            auto* session = this->networkSession(sessionID);
> 
> Not sure we need the "this->" here since there is no name collision.

I had to for this one because there is a networkSession variable outside the lambda and the compiler was complaining that it couldn't be called as a function and wasn't captured in the lambda.

> > Source/WebKit/NetworkProcess/NetworkSession.cpp:677
> > +    // *********
> > +    // IMPORTANT: Do not change the directory structure for indexed databases on disk without first consulting a reviewer from Apple (<rdar://problem/17454712>)
> > +    // *********
> 
> This is clearly a valuable comment. But is this function the absolute best
> place for it?
> 
> > Source/WebKit/NetworkProcess/ios/NetworkProcessIOS.mm:120
> > +        forEachNetworkSession([](auto& networkSession) {
> 
> Formatting tweak: can’t remember if we use spaces here.
> Cod style tweak: Always love the single words when the scope is small
> enough, so just "session" would be nice.

Ok.
Comment 7 Chris Dumez 2021-12-16 07:52:27 PST
Created attachment 447354 [details]
Patch
Comment 8 Chris Dumez 2021-12-16 11:42:46 PST
Created attachment 447376 [details]
Patch
Comment 9 Chris Dumez 2021-12-16 11:53:35 PST
Created attachment 447377 [details]
Patch
Comment 10 Chris Dumez 2021-12-16 11:59:11 PST
Created attachment 447379 [details]
Patch
Comment 11 Chris Dumez 2021-12-16 12:10:03 PST
Created attachment 447381 [details]
Patch
Comment 12 Chris Dumez 2021-12-16 12:28:24 PST
Created attachment 447384 [details]
Patch
Comment 13 EWS 2021-12-16 14:39:02 PST
Committed r287159 (245336@main): <https://commits.webkit.org/245336@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 447384 [details].
Comment 14 Radar WebKit Bug Importer 2021-12-16 15:09:59 PST
<rdar://problem/86598786>