Bug 199535 - WebBackForwardListItem::setPageState should receive pageState by reference
Summary: WebBackForwardListItem::setPageState should receive pageState by reference
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Trivial
Assignee: Michael Catanzaro
URL:
Keywords: InRadar
Depends on:
Blocks: 104114
  Show dependency treegraph
 
Reported: 2019-07-05 15:04 PDT by Michael Catanzaro
Modified: 2019-07-12 13:59 PDT (History)
6 users (show)

See Also:


Attachments
Patch (2.07 KB, patch)
2019-07-05 15:05 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff
Patch (2.69 KB, patch)
2019-07-11 16:07 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2019-07-05 15:04:28 PDT
Coverity is complaining here about copying PageState by value in the parameter list. It's sort of a false positive, in that the PageState really does need to be copied here, so this is the best we can do. But pass by value and then WTFMove() is a pretty strange way to write it. Just passing by reference would be better. Then it will be copied into m_itemState.pageState.
Comment 1 Michael Catanzaro 2019-07-05 15:05:38 PDT
Created attachment 373542 [details]
Patch
Comment 2 Carlos Alberto Lopez Perez 2019-07-11 05:58:13 PDT
Comment on attachment 373542 [details]
Patch

Looks good to me.
I think you need to CC some reviewers or this will be unnoticed
Comment 3 youenn fablet 2019-07-11 09:48:29 PDT
Comment on attachment 373542 [details]
Patch

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

> Source/WebKit/ChangeLog:12
> +        m_itemState.pageState..

I would tend to go with setPageState(PageState&&), except if it requires too much explicit PageState { } at call sites.
Doing setPageState(PageState) is somehow better than setPageState(const&) since it probably accepts both const& and && as parameters.
Comment 4 Michael Catanzaro 2019-07-11 16:07:45 PDT
Created attachment 373971 [details]
Patch
Comment 5 Michael Catanzaro 2019-07-11 16:08:33 PDT
(In reply to youenn fablet from comment #3)
> > Source/WebKit/ChangeLog:12
> > +        m_itemState.pageState..
> 
> I would tend to go with setPageState(PageState&&), except if it requires too
> much explicit PageState { } at call sites.

Sure. There's only one callsite.
Comment 6 WebKit Commit Bot 2019-07-12 13:58:49 PDT
Comment on attachment 373971 [details]
Patch

Clearing flags on attachment: 373971

Committed r247396: <https://trac.webkit.org/changeset/247396>
Comment 7 WebKit Commit Bot 2019-07-12 13:58:50 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2019-07-12 13:59:19 PDT
<rdar://problem/53025386>