Bug 175679

Summary: Regression(r220817): We should only copy the original request headers for Ping loads
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebCore Misc.Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, commit-queue, dbates, ggaren, japhet, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 175628    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Chris Dumez
Reported 2017-08-17 12:14:30 PDT
We should only copy the original request headers for Ping loads (Beacon at the moment), not for all CachedResourceRequests.
Attachments
Patch (8.40 KB, patch)
2017-08-17 12:16 PDT, Chris Dumez
no flags
Patch (8.32 KB, patch)
2017-08-17 13:00 PDT, Chris Dumez
no flags
Patch (27.61 KB, patch)
2017-08-17 14:30 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2017-08-17 12:16:04 PDT
youenn fablet
Comment 2 2017-08-17 12:47:06 PDT
Comment on attachment 318398 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=318398&action=review > Source/WebCore/loader/cache/CachedResourceLoader.cpp:836 > + resource->setOriginalRequestHeaders(WTFMove(originalRequestHeaders)); We should probably also set the headers in the case of DeferOption::Defer. If not, originalRequestHeaders could just be a parameter passed to CachedResource::load().
Chris Dumez
Comment 3 2017-08-17 13:00:00 PDT
youenn fablet
Comment 4 2017-08-17 13:09:48 PDT
Comment on attachment 318406 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=318406&action=review > Source/WebCore/loader/cache/CachedResource.cpp:276 > + platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, HTTPHeaderMap(*m_originalRequestHeaders), *m_origin, contentSecurityPolicy, m_options); IIRC, IPC is taking const& parameters. WK2 createPingHandle could probably be implemented with just a const&.
youenn fablet
Comment 5 2017-08-17 13:10:06 PDT
(In reply to youenn fablet from comment #4) > Comment on attachment 318406 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=318406&action=review > > > Source/WebCore/loader/cache/CachedResource.cpp:276 > > + platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, HTTPHeaderMap(*m_originalRequestHeaders), *m_origin, contentSecurityPolicy, m_options); > > IIRC, IPC is taking const& parameters. > WK2 createPingHandle could probably be implemented with just a const&. So that we remove this extra header copy.
Chris Dumez
Comment 6 2017-08-17 13:22:25 PDT
(In reply to youenn fablet from comment #5) > (In reply to youenn fablet from comment #4) > > Comment on attachment 318406 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=318406&action=review > > > > > Source/WebCore/loader/cache/CachedResource.cpp:276 > > > + platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, HTTPHeaderMap(*m_originalRequestHeaders), *m_origin, contentSecurityPolicy, m_options); > > > > IIRC, IPC is taking const& parameters. > > WK2 createPingHandle could probably be implemented with just a const&. > > So that we remove this extra header copy. WK2: loadParameters.originalRequestHeaders = WTFMove(originalRequestHeaders);
youenn fablet
Comment 7 2017-08-17 13:38:31 PDT
> WK2: > loadParameters.originalRequestHeaders = WTFMove(originalRequestHeaders); Would the following work? - Pass originalRequestHeaders as a direct parameter of NetworkConnectionToWebProcess::LoadPing. It is not used for other loads. - Create the message with something like Messages::NetworkConnectionToWebProcess::LoadPing(loadParameters, originalRequestHeaders) IIRC, Messages structures only needs const&.
Chris Dumez
Comment 8 2017-08-17 13:41:33 PDT
(In reply to youenn fablet from comment #7) > > WK2: > > loadParameters.originalRequestHeaders = WTFMove(originalRequestHeaders); > > Would the following work? > - Pass originalRequestHeaders as a direct parameter of > NetworkConnectionToWebProcess::LoadPing. It is not used for other loads. > - Create the message with something like > Messages::NetworkConnectionToWebProcess::LoadPing(loadParameters, > originalRequestHeaders) > > IIRC, Messages structures only needs const&. Yes, I have confirmed Messages structures only need const&. I can do what you suggest although I am unconvinced this is a worthwhile optimization.
youenn fablet
Comment 9 2017-08-17 13:51:21 PDT
> Yes, I have confirmed Messages structures only need const&. I can do what > you suggest although I am unconvinced this is a worthwhile optimization. Agreed, the main point of this patch is to limit the header copy to beacon. As a follow-up of that patch, I think it makes sense to split the original headers from NetworkLoaderParameters since they are related to ping loads only. It should be easy to add it back when implementing keepalive for fetch API loads, if we find these headers to be needed.
Chris Dumez
Comment 10 2017-08-17 13:53:22 PDT
(In reply to youenn fablet from comment #9) > > Yes, I have confirmed Messages structures only need const&. I can do what > > you suggest although I am unconvinced this is a worthwhile optimization. > > Agreed, the main point of this patch is to limit the header copy to beacon. > > As a follow-up of that patch, I think it makes sense to split the original > headers from NetworkLoaderParameters since they are related to ping loads > only. > It should be easy to add it back when implementing keepalive for fetch API > loads, if we find these headers to be needed. It's trivial, I'll do another iteration.
Chris Dumez
Comment 11 2017-08-17 14:30:32 PDT
Chris Dumez
Comment 12 2017-08-17 15:57:04 PDT
Comment on attachment 318423 [details] Patch Clearing flags on attachment: 318423 Committed r220888: <http://trac.webkit.org/changeset/220888>
Chris Dumez
Comment 13 2017-08-17 15:57:06 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 14 2017-08-17 15:57:34 PDT
Note You need to log in before you can comment on or make changes to this bug.