Bug 183010 - [Curl] Remove unnecessary copied ResourceRequest member variable.
Summary: [Curl] Remove unnecessary copied ResourceRequest member variable.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Basuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-02-21 11:48 PST by Basuke Suzuki
Modified: 2018-03-06 16:33 PST (History)
11 users (show)

See Also:


Attachments
patch (8.71 KB, patch)
2018-02-21 12:50 PST, Basuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (7.93 KB, patch)
2018-03-06 13:44 PST, Basuke Suzuki
youennf: review+
commit-queue: commit-queue-
Details | Formatted Diff | Diff
changelog (9.07 KB, patch)
2018-03-06 14:43 PST, Basuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Basuke Suzuki 2018-02-21 11:48:05 PST
It was used when both redirect and authentication happens, but by adding const reference getter to CurlRequest, it is no longer needed.
Comment 1 Basuke Suzuki 2018-02-21 12:21:08 PST
This is a successor bug for https://bugs.webkit.org/show_bug.cgi?id=181704.
Comment 2 Basuke Suzuki 2018-02-21 12:50:42 PST
Created attachment 334406 [details]
patch
Comment 3 youenn fablet 2018-03-02 13:42:30 PST
Comment on attachment 334406 [details]
patch

Some questions below.

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

> Source/WebCore/platform/network/ResourceHandle.h:300
> +    enum class PreflightRequest {

I am not clear what PreflightRequest means in that context.
In the context of HTTP, preflight requests are used for CORS, but this does not seem related.
Would there be a better name to explicit the purpose. Is it a mechanism to do conditional requests?

> Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp:136
> +Ref<CurlRequest> ResourceHandle::createCurlRequest(ResourceRequest& request, PreflightRequest preflight)

Would it make sense to take a ResourceRequest&& in case CurlRequest is probably creating its own copy of the request?

> Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp:364
> +    auto previousRequest = d->m_curlRequest->resourceRequest().isolatedCopy();

Is the isolatedCopy needed here?
Comment 4 Basuke Suzuki 2018-03-02 13:46:47 PST
Comment on attachment 334406 [details]
patch

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

Thanks for reviewing!

>> Source/WebCore/platform/network/ResourceHandle.h:300
>> +    enum class PreflightRequest {
> 
> I am not clear what PreflightRequest means in that context.
> In the context of HTTP, preflight requests are used for CORS, but this does not seem related.
> Would there be a better name to explicit the purpose. Is it a mechanism to do conditional requests?

Ah, right. I use preflight not meaning about CORS, but general meaning of preparation by parsing the headers or such info. Is `Preprocess` the better name?

>> Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp:136
>> +Ref<CurlRequest> ResourceHandle::createCurlRequest(ResourceRequest& request, PreflightRequest preflight)
> 
> Would it make sense to take a ResourceRequest&& in case CurlRequest is probably creating its own copy of the request?

Okay, i'll think about it.

>> Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp:364
>> +    auto previousRequest = d->m_curlRequest->resourceRequest().isolatedCopy();
> 
> Is the isolatedCopy needed here?

Ditto.
Comment 5 youenn fablet 2018-03-02 13:54:56 PST
> > I am not clear what PreflightRequest means in that context.
> > In the context of HTTP, preflight requests are used for CORS, but this does not seem related.
> > Would there be a better name to explicit the purpose. Is it a mechanism to do conditional requests?
> 
> Ah, right. I use preflight not meaning about CORS, but general meaning of
> preparation by parsing the headers or such info. Is `Preprocess` the better
> name?

Preprocess is very generic as well and it seems that this is related to an existing cache so I would try to come up with a name inducing the notion of cache.

If this is related to HTTP conditional request/revalidation, I would try to make the name as specific as possible.
Comment 6 Basuke Suzuki 2018-03-06 13:44:04 PST
Created attachment 335136 [details]
Patch

Rename Preflight to RequestStatus which indicates it's new or reuse. Also stop isolateCopy, but simple copy. Move is not used here because original request need to be valid in m_firstRequest.
Comment 7 WebKit Commit Bot 2018-03-06 14:37:01 PST
Comment on attachment 335136 [details]
Patch

Rejecting attachment 335136 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 335136, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
=335136
Found no modified ChangeLogs, cannot create a commit message.
All changes require a ChangeLog.  See:
 http://webkit.org/coding/contributing.html
Found no modified ChangeLogs, cannot create a commit message.
All changes require a ChangeLog.  See:
 http://webkit.org/coding/contributing.html
Found no modified ChangeLogs, cannot create a commit message.
All changes require a ChangeLog.  See:
 http://webkit.org/coding/contributing.html
Updating OpenSource
Current branch master is up to date.

Full output: http://webkit-queues.webkit.org/results/6831883
Comment 8 Basuke Suzuki 2018-03-06 14:43:52 PST
Created attachment 335142 [details]
changelog
Comment 9 WebKit Commit Bot 2018-03-06 16:32:53 PST
Comment on attachment 335142 [details]
changelog

Clearing flags on attachment: 335142

Committed r229347: <https://trac.webkit.org/changeset/229347>
Comment 10 WebKit Commit Bot 2018-03-06 16:32:54 PST
All reviewed patches have been landed.  Closing bug.
Comment 11 Radar WebKit Bug Importer 2018-03-06 16:33:34 PST
<rdar://problem/38200401>