RESOLVED FIXED 173273
Modernize UserScript.h
https://bugs.webkit.org/show_bug.cgi?id=173273
Summary Modernize UserScript.h
Alex Christensen
Reported 2017-06-12 14:00:55 PDT
Modernize UserScript.h
Attachments
Patch (13.85 KB, patch)
2017-06-12 14:04 PDT, Alex Christensen
no flags
Patch (13.87 KB, patch)
2017-06-12 14:30 PDT, Alex Christensen
no flags
Patch (13.83 KB, patch)
2017-06-12 15:19 PDT, Alex Christensen
no flags
Alex Christensen
Comment 1 2017-06-12 14:04:36 PDT
Alex Christensen
Comment 2 2017-06-12 14:30:07 PDT
Alex Christensen
Comment 3 2017-06-12 15:19:34 PDT
Alex Christensen
Comment 4 2017-06-12 15:38:21 PDT
Darin Adler
Comment 5 2017-06-14 07:35:08 PDT
Comment on attachment 312708 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=312708&action=review > Source/WebCore/page/UserScript.h:35 > class UserScript { This seems like a struct, not a class. All it has is the constructor and getter functions for all data members. That’s exactly what a const struct is like. > Source/WebCore/page/UserScript.h:38 > + UserScript() { } We could write this instead, which I prefer. UserScript() = default; > Source/WebCore/page/UserScript.h:39 > + ~UserScript() { } This should be omitted. This is what the compiler will do if you don’t define a destructor. > Source/WebCore/page/UserScript.h:59 > + template<class Encoder> void encode(Encoder&) const; > + template<class Decoder> static bool decode(Decoder&, UserScript&); We normally prefer typename rather than class for the type arguments. Why do these functions need to be members? They can be written entirely using public interface.
Alex Christensen
Comment 6 2017-06-14 11:13:42 PDT
(In reply to Darin Adler from comment #5) > Comment on attachment 312708 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=312708&action=review > > > Source/WebCore/page/UserScript.h:35 > > class UserScript { > > This seems like a struct, not a class. All it has is the constructor and > getter functions for all data members. That’s exactly what a const struct is > like. > Yep, could be done. > > Source/WebCore/page/UserScript.h:38 > > + UserScript() { } > > We could write this instead, which I prefer. > > UserScript() = default; > > > Source/WebCore/page/UserScript.h:39 > > + ~UserScript() { } > > This should be omitted. This is what the compiler will do if you don’t > define a destructor. > I agree with these pieces of feedback, and I did them in earlier patches, but EWS/El Capitan's compilers failed to link WebKit2 for some reason. > > Source/WebCore/page/UserScript.h:59 > > + template<class Encoder> void encode(Encoder&) const; > > + template<class Decoder> static bool decode(Decoder&, UserScript&); > > We normally prefer typename rather than class for the type arguments. > > Why do these functions need to be members? They can be written entirely > using public interface. > Indeed
Note You need to log in before you can comment on or make changes to this bug.