WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
154984
Use NetworkSession for pings when using NetworkSession
https://bugs.webkit.org/show_bug.cgi?id=154984
Summary
Use NetworkSession for pings when using NetworkSession
Alex Christensen
Reported
2016-03-03 15:26:02 PST
Use NetworkSession for pings when using NetworkSession
Attachments
Patch
(10.55 KB, patch)
2016-03-03 15:28 PST
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(10.46 KB, patch)
2016-03-03 15:58 PST
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(10.50 KB, patch)
2016-03-03 22:01 PST
,
Alex Christensen
koivisto
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Alex Christensen
Comment 1
2016-03-03 15:28:38 PST
Created
attachment 272779
[details]
Patch
Alex Christensen
Comment 2
2016-03-03 15:58:17 PST
Created
attachment 272786
[details]
Patch
Darin Adler
Comment 3
2016-03-03 21:23:29 PST
Comment on
attachment 272786
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=272786&action=review
> Source/WebKit2/NetworkProcess/PingLoad.h:71 > + virtual void willPerformHTTPRedirection(const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, RedirectCompletionHandler completionHandler) > + { > + completionHandler({ }); > + delete this; > + } > + virtual void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler completionHandler) > + { > + completionHandler(AuthenticationChallengeDisposition::Cancel, { }); > + delete this; > + } > + virtual void didReceiveResponseNetworkSession(const WebCore::ResourceResponse&, ResponseCompletionHandler completionHandler) > + { > + completionHandler(WebCore::PolicyAction::PolicyIgnore); > + delete this; > + } > + virtual void didReceiveData(RefPtr<WebCore::SharedBuffer>&&) { ASSERT_NOT_REACHED(); } > + virtual void didCompleteWithError(const WebCore::ResourceError&) { delete this; } > + virtual void didBecomeDownload() { ASSERT_NOT_REACHED(); } > + virtual void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) { ASSERT_NOT_REACHED(); } > + virtual void wasBlocked() { delete this; } > + virtual void cannotShowURL() { delete this; }
These should all be marked override, and not virtual.
Alex Christensen
Comment 4
2016-03-03 22:01:23 PST
Created
attachment 272833
[details]
Patch
Alex Christensen
Comment 5
2016-03-03 22:47:09 PST
Comment on
attachment 272833
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=272833&action=review
> Source/WebKit2/NetworkProcess/PingLoad.h:69 > + void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) override { ASSERT_NOT_REACHED(); }
This assertion was being hit in many tests. Will commit without it if reviewed.
Antti Koivisto
Comment 6
2016-03-04 09:56:54 PST
Comment on
attachment 272833
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=272833&action=review
> Source/WebKit2/ChangeLog:3 > + Use NetworkSession for pings when using NetworkSession
The title could be reformulated with just one 'NetworkSession'
> Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp:145 > RefPtr<NetworkingContext> context = RemoteNetworkingContext::create(loadParameters.sessionID, loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect); > > +#if USE(NETWORK_SESSION) > + // PingLoad manages its own lifetime, deleting itself when its purpose has been fulfilled. > + new PingLoad(loadParameters); > +#else > // PingHandle manages its own lifetime, deleting itself when its purpose has been fulfilled. > new PingHandle(context.get(), loadParameters.request, loadParameters.allowStoredCredentials == AllowStoredCredentials, PingHandle::UsesAsyncCallbacks::Yes); > +#endif
RemoteNetworkingContext doesn't seems to be used in USE(NETWORK_SESSION) path. It should be moved inside the #else branch.
Alex Christensen
Comment 7
2016-03-04 10:01:59 PST
http://trac.webkit.org/changeset/197568
Darin Adler
Comment 8
2016-03-05 18:48:42 PST
Comment on
attachment 272833
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=272833&action=review
> Source/WebKit2/NetworkProcess/PingLoad.h:34 > +class PingLoad : public NetworkDataTaskClient {
Should mark the class final. Also, I think that it could be private inheritance rather than public.
> Source/WebKit2/NetworkProcess/PingLoad.h:36 > + PingLoad(const NetworkResourceLoadParameters& parameters)
Typically we’d want to mark this explicit. Also, in a class that deletes itself like this, I think it’s better to only expose a static member function to trigger this load and not return the pointer. That way the caller doesn’t have to write what looks like incorrect code.
> Source/WebKit2/NetworkProcess/PingLoad.h:37 > + : m_timeoutTimer(*this, &PingLoad::timeoutTimerFired)
I new code, a bit more elegant to write this with a lambda: : m_timeoutTimer(*this, [this]() { delete this; })
> Source/WebKit2/NetworkProcess/PingLoad.h:43 > + if (auto* networkSession = SessionTracker::networkSession(parameters.sessionID)) { > + m_task = NetworkDataTask::create(*networkSession, *this, parameters.request, parameters.allowStoredCredentials, parameters.contentSniffingPolicy, parameters.shouldClearReferrerOnHTTPSToHTTPRedirect); > + m_task->resume(); > + } else > + ASSERT_NOT_REACHED();
The if does us no good. If you really want an assertion then I’d just write: auto* networkSession = SessionTracker::networkSession(parameters.sessionID); ASSERT(networkSession); ... But I’d suggest not bothering with the assertion.
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