RESOLVED FIXED 122942
PingLoader objects unnecessarily pass through OwnPtr
https://bugs.webkit.org/show_bug.cgi?id=122942
Summary PingLoader objects unnecessarily pass through OwnPtr
Zan Dobersek
Reported 2013-10-17 00:00:19 PDT
PingLoader objects unnecessarily pass through OwnPtr
Attachments
Patch (3.85 KB, patch)
2013-10-17 00:18 PDT, Zan Dobersek
no flags
Patch (4.08 KB, patch)
2013-11-03 02:30 PST, Zan Dobersek
no flags
Patch (4.09 KB, patch)
2013-11-03 03:23 PST, Zan Dobersek
no flags
Patch (4.09 KB, patch)
2013-11-03 03:55 PST, Zan Dobersek
darin: review+
Zan Dobersek
Comment 1 2013-10-17 00:18:10 PDT
Darin Adler
Comment 2 2013-11-02 14:16:10 PDT
Comment on attachment 214425 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=214425&action=review OK as is. Room for improvement. > Source/WebCore/loader/PingLoader.cpp:71 > + PingLoader* pingLoader = new PingLoader(frame, request); > + UNUSED_PARAM(pingLoader); I don’t think we need the variable at all. It’s also strange to use UNUSED_PARAM for this. The word is “delete”, not “kill”. Also, I think we should have a helper member function to hide the use of "new". I don’t like having these calls to new with the comments in three different places in the file. It should just be one small inline function. > Source/WebCore/loader/PingLoader.cpp:102 > + // No need to free the PingLoader object or manage it via a smart pointer - it will kill itself as soon as it receives a response. > + PingLoader* pingLoader = new PingLoader(frame, request); > + UNUSED_PARAM(pingLoader); Ditto. > Source/WebCore/loader/PingLoader.cpp:122 > + // No need to free the PingLoader object or manage it via a smart pointer - it will kill itself as soon as it receives a response. > + PingLoader* pingLoader = new PingLoader(frame, request); > + UNUSED_PARAM(pingLoader); Ditto.
Zan Dobersek
Comment 3 2013-11-03 02:30:52 PST
Zan Dobersek
Comment 4 2013-11-03 03:23:03 PST
Zan Dobersek
Comment 5 2013-11-03 03:55:13 PST
Darin Adler
Comment 6 2013-11-03 16:57:59 PST
Comment on attachment 215864 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=215864&action=review > Source/WebCore/loader/PingLoader.h:68 > + static inline void createPingLoader(Frame* frame, ResourceRequest& request) > + { > + // No need to free the PingLoader object or manage it via a smart pointer - it will kill itself as soon as it receives a response. > + new PingLoader(frame, request); > + } Since this is in the class definition, the inline keyword is unneeded. Since this is only used in the .cpp file, it need not be in the class definition. I can be in the .cpp file, and just be declared in the class definition.
Zan Dobersek
Comment 7 2013-11-03 23:08:15 PST
Note You need to log in before you can comment on or make changes to this bug.