RESOLVED FIXED 185654
Cleanup platform Cookie
https://bugs.webkit.org/show_bug.cgi?id=185654
Summary Cleanup platform Cookie
Daniel Bates
Reported 2018-05-15 11:38:08 PDT
Cleanup platform Cookie.
Attachments
Patch (7.71 KB, patch)
2018-05-15 12:01 PDT, Daniel Bates
no flags
Patch (11.18 KB, patch)
2018-05-15 12:19 PDT, Daniel Bates
no flags
Patch (11.68 KB, patch)
2018-05-15 12:44 PDT, Daniel Bates
pvollan: review+
ews-watchlist: commit-queue-
Archive of layout-test-results from ews205 for win-future (12.79 MB, application/zip)
2018-05-16 01:22 PDT, EWS Watchlist
no flags
Daniel Bates
Comment 1 2018-05-15 12:01:50 PDT
EWS Watchlist
Comment 2 2018-05-15 12:05:12 PDT
Attachment 340425 [details] did not pass style-queue: ERROR: Source/WebCore/platform/network/cocoa/CookieCocoa.mm:76: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Daniel Bates
Comment 3 2018-05-15 12:19:18 PDT
EWS Watchlist
Comment 4 2018-05-15 12:22:19 PDT
Attachment 340426 [details] did not pass style-queue: ERROR: Source/WebCore/platform/network/cocoa/CookieCocoa.mm:76: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Daniel Bates
Comment 5 2018-05-15 12:44:56 PDT
EWS Watchlist
Comment 6 2018-05-15 12:47:01 PDT
Attachment 340428 [details] did not pass style-queue: ERROR: Source/WebCore/platform/network/cocoa/CookieCocoa.mm:76: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alex Christensen
Comment 7 2018-05-15 13:02:57 PDT
Comment on attachment 340428 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=340428&action=review > Source/WebCore/platform/Cookie.h:118 > - std::optional<String> value; > - decoder >> value; > - if (!value) > + if (!decoder.decode(cookie.value)) > return std::nullopt; This is moving away from the newer way of doing decoding.
Daniel Bates
Comment 8 2018-05-15 14:10:20 PDT
(In reply to Alex Christensen from comment #7) > Comment on attachment 340428 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=340428&action=review > > > Source/WebCore/platform/Cookie.h:118 > > - std::optional<String> value; > > - decoder >> value; > > - if (!value) > > + if (!decoder.decode(cookie.value)) > > return std::nullopt; > > This is moving away from the newer way of doing decoding. Can you please elaborate on the benefit with respect to this class?
Alex Christensen
Comment 9 2018-05-15 14:14:52 PDT
The old way of decoding, decoder.decode(T&), requires that T have a default constructor. The new way of decoding, operator>>(std::optional<T>&) does not, so I introduced it to allow sending and receiving types that do not have a default constructor. It would be nice if our IPC code were consistent and new, so I don't think we should take a step towards the old way of doing things.
Brady Eidson
Comment 10 2018-05-15 14:25:32 PDT
(In reply to Alex Christensen from comment #9) > The old way of decoding, decoder.decode(T&), requires that T have a default > constructor. The new way of decoding, operator>>(std::optional<T>&) does > not, so I introduced it to allow sending and receiving types that do not > have a default constructor. It would be nice if our IPC code were > consistent and new, so I don't think we should take a step towards the old > way of doing things. The new optional<> way allows us to decode types without default constructors - Which is great! I've used it for that reason. But it seems bizarre to say that means we can't *ever* use the old pattern, even when this constraint doesn't apply. I think the old way is much more readable code and still use it *when it can* be used. I disagree with the statement "it would be nice if our IPC code were consistent and new" "New" does not mean better, and "consistent" sounds to me like an attempt to impose a special case on the general case even when the general case would be preferable. Is there a technical, non-subjective reason why the new way should always be applied? Otherwise, could this patch be re-reviewed?
Alex Christensen
Comment 11 2018-05-15 14:57:55 PDT
Comment on attachment 340428 [details] Patch I don't think it's good to undo code modernization work. Making the IPC code consistent and new is a step towards making it more autogenerated or generated by meta programming. If you really want to undo this work anyways, go for it.
EWS Watchlist
Comment 12 2018-05-16 01:22:43 PDT
Comment on attachment 340428 [details] Patch Attachment 340428 [details] did not pass win-ews (win): Output: http://webkit-queues.webkit.org/results/7696036 New failing tests: http/tests/security/canvas-remote-read-remote-video-blocked-no-crossorigin.html
EWS Watchlist
Comment 13 2018-05-16 01:22:53 PDT
Created attachment 340476 [details] Archive of layout-test-results from ews205 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews205 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Per Arne Vollan
Comment 14 2018-05-16 11:36:16 PDT
Comment on attachment 340428 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=340428&action=review R=me. > Source/WebCore/platform/Cookie.h:62 > + return name.isNull() && value.isNull() && domain.isNull() && path.isNull() && !created I think the previous version was more readable, but I leave this up to you.
Daniel Bates
Comment 15 2018-05-16 11:38:49 PDT
(In reply to Alex Christensen from comment #11) > Comment on attachment 340428 [details] > Patch > > I don't think it's good to undo code modernization work. I agree with Brady's characterization that what you call "modernization" is "an attempt to impose a special case on the general case even when the general case would be preferable." > Making the IPC code consistent and new is a step towards making it more autogenerated or generated by meta programming. I consider the goals "making the IPC code consistent and new" and "making it more autogenerated or generated by meta programming" as independent of each other. The former may make it easier to do the latter, but is not necessary to achieve the latter. > If you really want to undo this work anyways, go for it. We need to have a discussion (maybe on webkit-dev) about how we want to evolve the IPC decoding/encoding. Neither Brady nor I am convinced that decoding to std::optional is the "one true way" to do all decoding.
Daniel Bates
Comment 16 2018-05-16 11:50:59 PDT
(In reply to Per Arne Vollan from comment #14) > > Source/WebCore/platform/Cookie.h:62 > > + return name.isNull() && value.isNull() && domain.isNull() && path.isNull() && !created > > I think the previous version was more readable, but I leave this up to you. Will revert this stylistic change before landing.
Daniel Bates
Comment 17 2018-05-16 11:55:19 PDT
Radar WebKit Bug Importer
Comment 18 2018-05-16 12:02:13 PDT
Note You need to log in before you can comment on or make changes to this bug.