WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 150857
Create a NetworkSession for each SessionID
https://bugs.webkit.org/show_bug.cgi?id=150857
Summary
Create a NetworkSession for each SessionID
Alex Christensen
Reported
2015-11-03 14:23:26 PST
Allow multiple NetworkSessions
Attachments
Patch
(25.85 KB, patch)
2015-11-03 14:29 PST
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(25.98 KB, patch)
2015-11-03 14:37 PST
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(27.87 KB, patch)
2015-11-03 14:47 PST
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(27.95 KB, patch)
2015-11-03 15:26 PST
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(27.58 KB, patch)
2015-11-03 15:28 PST
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(27.60 KB, patch)
2015-11-03 16:36 PST
,
Alex Christensen
andersca
: review+
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Alex Christensen
Comment 1
2015-11-03 14:29:34 PST
Created
attachment 264726
[details]
Patch
Alex Christensen
Comment 2
2015-11-03 14:37:53 PST
Created
attachment 264728
[details]
Patch
Alex Christensen
Comment 3
2015-11-03 14:47:09 PST
Created
attachment 264731
[details]
Patch
Darin Adler
Comment 4
2015-11-03 14:51:02 PST
Comment on
attachment 264728
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=264728&action=review
> Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp:195 > + RELEASE_ASSERT(networkSession);
Why do we need to assert here at all? Particularly, why a RELEASE_ASSERT?
> Source/WebKit2/NetworkProcess/NetworkSession.h:95 > + explicit NetworkDataTask(NetworkSession&, NetworkSessionTaskClient&, RetainPtr<NSURLSessionDataTask>);
The argument to this function should just be NSURLSessionDataTask *, not a RetainPtr. If you were trying to save retain count churn, maybe RetainPtr&&.
> Source/WebKit2/NetworkProcess/NetworkSession.h:115 > + NetworkSession(Type, WebCore::SessionID); > + ~NetworkSession();
A little non-standard in style to declare the constructor and destructor after declaring other member functions.
> Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm:177 > +static std::unique_ptr<NetworkSession>& defaultNetworkSession() > +{ > + ASSERT(isMainThread()); > + static NeverDestroyed<std::unique_ptr<NetworkSession>> session; > + return session; > +}
No need for this helper function.
> Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm:183 > + if (!defaultNetworkSession()) > + defaultNetworkSession() = std::make_unique<NetworkSession>(NetworkSession::Type::Normal, WebCore::SessionID::defaultSessionID()); > + return *defaultNetworkSession();
No helper function or make_unique needed: ASSERT(isMainThread()); static NeverDestroyed<NetworkSession> session(NetworkSession::Type::Normal, WebCore::SessionID::defaultSessionID()); return session;
> Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm:202 > + RELEASE_ASSERT(dataTask);
Why do we need to assert here at all? Particularly, why a RELEASE_ASSERT?
Alex Christensen
Comment 5
2015-11-03 15:26:20 PST
Created
attachment 264738
[details]
Patch
Alex Christensen
Comment 6
2015-11-03 15:28:40 PST
Created
attachment 264739
[details]
Patch
Alex Christensen
Comment 7
2015-11-03 15:57:05 PST
Comment on
attachment 264739
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=264739&action=review
> Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm:195 > + for (auto* dataTask : m_dataTaskMap.values()) > + dataTask->cancel();
I'm not sure if this is correct. I had an ASSERT(m_dataTaskMap.isEmpty()) before, but I wasn't sure that will always be true. Now I think it might.
Alex Christensen
Comment 8
2015-11-03 16:36:11 PST
Created
attachment 264753
[details]
Patch
Anders Carlsson
Comment 9
2015-11-03 16:41:48 PST
Comment on
attachment 264753
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=264753&action=review
> Source/WebKit2/NetworkProcess/NetworkSession.h:103 > + friend class NetworkDataTask;
Why friend?
> Source/WebKit2/Shared/SessionTracker.cpp:85 > + return map.get();
I think you can just return map here.
Alex Christensen
Comment 10
2015-11-03 16:49:30 PST
(In reply to
comment #9
)
> Comment on
attachment 264753
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=264753&action=review
> > > Source/WebKit2/NetworkProcess/NetworkSession.h:103 > > + friend class NetworkDataTask; > > Why friend?
A NetworkDataTask adds itself to m_dataTaskMap in its constructor and removes itself in the destructor.
> > > Source/WebKit2/Shared/SessionTracker.cpp:85 > > + return map.get(); > > I think you can just return map here.
Yep, and a few other places in this file.
Alex Christensen
Comment 11
2015-11-03 16:51:31 PST
http://trac.webkit.org/changeset/191998
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug