Bug 223776

Summary: Refactor NetworkSessionCocoa to prepare for per-WebPageProxy sessions
Product: WebKit Reporter: Brady Eidson <beidson>
Component: WebKit Misc.Assignee: Brady Eidson <beidson>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch for EWS
ews-feeder: commit-queue-
Patch for EWS
ews-feeder: commit-queue-
Patch for EWS
achristensen: review+
Patch for landing none

Brady Eidson
Reported 2021-03-25 16:56:13 PDT
Refactor NetworkSessionCocoa to prepare for per-WebPageProxy sessions For upcoming work, different WKWebViews sharing one logical NetworkSession will need different NSURLSessions to do their networking. To prepare for that, this patch will do a no-change-in-behavior refactor that accounts for the ability to "look up the set of NSURLSessions by WebPageProxyIdentifier"
Attachments
Patch for EWS (66.30 KB, patch)
2021-03-25 17:01 PDT, Brady Eidson
ews-feeder: commit-queue-
Patch for EWS (68.10 KB, patch)
2021-03-25 17:47 PDT, Brady Eidson
ews-feeder: commit-queue-
Patch for EWS (68.15 KB, patch)
2021-03-25 22:59 PDT, Brady Eidson
achristensen: review+
Patch for landing (68.95 KB, patch)
2021-03-26 12:31 PDT, Brady Eidson
no flags
Brady Eidson
Comment 1 2021-03-25 17:01:02 PDT
Created attachment 424300 [details] Patch for EWS
Brady Eidson
Comment 2 2021-03-25 17:43:21 PDT
That makes sense, yay EWS
Brady Eidson
Comment 3 2021-03-25 17:47:21 PDT
Created attachment 424308 [details] Patch for EWS
Brady Eidson
Comment 4 2021-03-25 22:59:47 PDT
Created attachment 424319 [details] Patch for EWS
Alex Christensen
Comment 5 2021-03-25 23:25:00 PDT
Comment on attachment 424319 [details] Patch for EWS View in context: https://bugs.webkit.org/attachment.cgi?id=424319&action=review > Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h:159 > + HashMap<WebPageProxyIdentifier, RefPtr<SessionSet>> m_perPageSessionSets; I think the value could be made a Ref > Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:1298 > + // FIXME: https://bugs.webkit.org/show_bug.cgi?id=177394 You may as well remove this comment and the 2 lines below. We know why we can't do this, and we typically don't like having commented out code in WebKit. > Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:1307 > + SessionSet* sessionSet = webPageProxyID ? m_perPageSessionSets.get(webPageProxyID) : nullptr; If webPageProxyID can be 0 then it should probably be an Optional<WebPageProxyIdentifier> If you're protecting against strange things happening to the HashTable, you should probably use decltype(m_perPageSessionSets.get)::isValidKey > Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:1319 > + return sessionSetForPage(pageID).initializeEphemeralStatelessSessionIfNeeded(isNavigatingToAppBoundDomain, *this); You call pageID webPageProxyID everywhere else in this patch. Why not here?
Brady Eidson
Comment 6 2021-03-26 12:17:32 PDT
(In reply to Alex Christensen from comment #5) > Comment on attachment 424319 [details] > Patch for EWS All suggestions taken except: > If webPageProxyID can be 0 then it should probably be an > Optional<WebPageProxyIdentifier> > If you're protecting against strange things happening to the HashTable, you > should probably use decltype(m_perPageSessionSets.get)::isValidKey In this patch it can be 0 (and in fact PingLoaders do not necessarily have a proper page context, so they are 0) In the next patch there will be protection against zero. ObjectIdentifier<> already has established patterns of "0 means no valid ID", I don't think we need to explore a new direction on that this time around.
Brady Eidson
Comment 7 2021-03-26 12:31:51 PDT
Created attachment 424391 [details] Patch for landing
EWS
Comment 8 2021-03-26 15:05:40 PDT
Committed r275116: <https://commits.webkit.org/r275116> All reviewed patches have been landed. Closing bug and clearing flags on attachment 424391 [details].
Radar WebKit Bug Importer
Comment 9 2021-03-26 15:06:14 PDT
Note You need to log in before you can comment on or make changes to this bug.