RESOLVED FIXED 192288
Merge parseAccessControlExposeHeadersAllowList into parseAccessControlAllowList
https://bugs.webkit.org/show_bug.cgi?id=192288
Summary Merge parseAccessControlExposeHeadersAllowList into parseAccessControlAllowList
Rob Buis
Reported 2018-12-02 08:26:45 PST
Merge parseAccessControlExposeHeadersAllowList into parseAccessControlAllowList as they do the same thing.
Attachments
Patch (10.34 KB, patch)
2018-12-02 08:30 PST, Rob Buis
no flags
Patch (5.03 KB, patch)
2018-12-10 12:24 PST, Rob Buis
no flags
Rob Buis
Comment 1 2018-12-02 08:30:46 PST
Frédéric Wang (:fredw)
Comment 2 2018-12-04 07:39:38 PST
Comment on attachment 356339 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=356339&action=review > Source/WebCore/platform/network/HTTPParsers.h:-167 > - return set; parseAccessControlAllowList + addToAccessControlAllowList are less readable than parseAccessControlExposeHeadersAllowList as they try to avoid creating unnecessary substrings. I think you can rewrite this in a more concise way using StringViews: String::split(UChar separator, const SplitFunctor& functor) StringView::stripLeadingAndTrailingMatchedCharacters StringView::isEmpty()
WebKit Commit Bot
Comment 3 2018-12-07 10:33:50 PST
Comment on attachment 356339 [details] Patch Clearing flags on attachment: 356339 Committed r238953: <https://trac.webkit.org/changeset/238953>
WebKit Commit Bot
Comment 4 2018-12-07 10:33:51 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 5 2018-12-07 10:34:44 PST
Darin Adler
Comment 6 2018-12-07 23:59:11 PST
Comment on attachment 356339 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=356339&action=review > Source/WebCore/platform/network/HTTPParsers.h:152 > -std::optional<HashSet<String, HashType>> parseAccessControlAllowList(const String& string) > +void parseAccessControlAllowList(const String& string, HashSet<String, HashType>& set) Why is this using a reference argument instead of a return value?
Rob Buis
Comment 7 2018-12-09 14:00:31 PST
(In reply to Darin Adler from comment #6) > Comment on attachment 356339 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=356339&action=review > > > Source/WebCore/platform/network/HTTPParsers.h:152 > > -std::optional<HashSet<String, HashType>> parseAccessControlAllowList(const String& string) > > +void parseAccessControlAllowList(const String& string, HashSet<String, HashType>& set) > > Why is this using a reference argument instead of a return value? It seemed more convenient and natural to use out parameters here. Are you thinking return value is more efficient here because then we can skip the clear()s? I can do a follow up patch if so...
Darin Adler
Comment 8 2018-12-09 17:17:04 PST
I think return values are more natural. We used out parameters for large things in the old days because we feared the cost of copying structures, but in modern C++ with the return value optimization and move semantics it seems we can use return values.
Rob Buis
Comment 9 2018-12-10 12:24:11 PST
Reopening to attach new patch.
Rob Buis
Comment 10 2018-12-10 12:24:14 PST
Rob Buis
Comment 11 2018-12-10 13:18:29 PST
(In reply to Darin Adler from comment #8) > I think return values are more natural. > > We used out parameters for large things in the old days because we feared > the cost of copying structures, but in modern C++ with the return value > optimization and move semantics it seems we can use return values. True, I put up a patch for this.
WebKit Commit Bot
Comment 12 2018-12-19 00:00:34 PST
Comment on attachment 356980 [details] Patch Clearing flags on attachment: 356980 Committed r239372: <https://trac.webkit.org/changeset/239372>
WebKit Commit Bot
Comment 13 2018-12-19 00:00:36 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.