[webkit-reviews] review granted: [Bug 206426] Add logging of the source of a response used to respond a fetch event : [Attachment 388052] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 20 12:35:17 PST 2020


Darin Adler <darin at apple.com> has granted youenn fablet <youennf at gmail.com>'s
request for review:
Bug 206426: Add logging of the source of a response used to respond a fetch
event
https://bugs.webkit.org/show_bug.cgi?id=206426

Attachment 388052: Patch

https://bugs.webkit.org/attachment.cgi?id=388052&action=review




--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 388052
  --> https://bugs.webkit.org/attachment.cgi?id=388052
Patch

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

> Source/WebCore/Modules/cache/DOMCache.cpp:578
> +		   auto resourceResponse = WTFMove(record.response);
> +		  
resourceResponse.setSource(ResourceResponse::Source::DOMCache);

We do not need to move this into a local variable to modify it. We can just
write:

    record.response.setSource(ResourceResponse::Source::DOMCache);

and not make the other changes. Basically, an rvalue reference gives us the
permission to modify and/or take the value of something. No reason we need to
move it to modify it.

If we were copying rather than moving, then yes, it’s important to copy before
modifying something. But that’s not the case here.

> Source/WebCore/Modules/cache/DOMCache.cpp:591
> +	       auto resourceResponse = WTFMove(record.response);
> +	       resourceResponse.setSource(ResourceResponse::Source::DOMCache);

Ditto.


More information about the webkit-reviews mailing list