Bug 154721 - Refactor FetchBody constructors
Summary: Refactor FetchBody constructors
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: youenn fablet
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-26 01:10 PST by youenn fablet
Modified: 2016-02-29 05:01 PST (History)
3 users (show)

See Also:


Attachments
Patch (7.81 KB, patch)
2016-02-26 01:13 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (7.80 KB, patch)
2016-02-29 01:20 PST, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2016-02-26 01:10:10 PST
Following on bug 154536, it might be good to refactor a bit FetchBody constructors: use the move constructor, renaming fromJSValue to extract and remove empty  static method.
Comment 1 youenn fablet 2016-02-26 01:13:19 PST
Created attachment 272317 [details]
Patch
Comment 2 Darin Adler 2016-02-26 09:24:31 PST
Comment on attachment 272317 [details]
Patch

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

> Source/WebCore/Modules/fetch/FetchBody.h:73
> +    FetchBody() { }

I sometimes prefer to write = default for these instead of writing out the inline empty body.

> Source/WebCore/Modules/fetch/FetchResponse.cpp:53
> +    return adoptRef(*new FetchResponse(Type::Error, FetchBody(), FetchHeaders::create(FetchHeaders::Guard::Immutable), ResourceResponse()));

Could just use { } here instead of FetchBody().

> Source/WebCore/Modules/fetch/FetchResponse.cpp:68
> +    RefPtr<FetchResponse> redirectResponse = adoptRef(*new FetchResponse(Type::Default, FetchBody(), FetchHeaders::create(FetchHeaders::Guard::Immutable), ResourceResponse()));

Could just use { } here instead of FetchBody().

> Source/WebCore/Modules/fetch/FetchResponse.h:50
> +    static Ref<FetchResponse> create() { return adoptRef(*new FetchResponse(Type::Default, FetchBody(), FetchHeaders::create(FetchHeaders::Guard::Response), ResourceResponse())); }

Could just use { } here instead of FetchBody().
Comment 3 youenn fablet 2016-02-29 01:20:57 PST
Created attachment 272478 [details]
Patch
Comment 4 youenn fablet 2016-02-29 01:21:31 PST
(In reply to comment #3)
> Created attachment 272478 [details]
> Patch

Thanks for the reviews.
I updated the patch with Darin's suggestions.
Comment 5 WebKit Commit Bot 2016-02-29 05:01:45 PST
Comment on attachment 272478 [details]
Patch

Clearing flags on attachment: 272478

Committed r197347: <http://trac.webkit.org/changeset/197347>
Comment 6 WebKit Commit Bot 2016-02-29 05:01:48 PST
All reviewed patches have been landed.  Closing bug.