PingLoader objects unnecessarily pass through OwnPtr
Created attachment 214425 [details] Patch
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.
Created attachment 215859 [details] Patch
Created attachment 215863 [details] Patch
Created attachment 215864 [details] Patch
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.
Committed r158558: <http://trac.webkit.org/changeset/158558>