Bug 154721

Summary: Refactor FetchBody constructors
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebCore Misc.Assignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, commit-queue, darin
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

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.