Bug 130636

Summary: Add *final* keyword to NavigatorContentUtils class
Product: WebKit Reporter: Gyuyoung Kim <gyuyoung.kim>
Component: New BugsAssignee: Gyuyoung Kim <gyuyoung.kim>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Gyuyoung Kim
Reported 2014-03-22 00:43:24 PDT
Though NavigatorContentUtils isn't declared final class as well as it doesn't have any virtual function, the destructor has been declared as virtual. We don't need to declare the destructor as virtual.
Attachments
Patch (1.78 KB, patch)
2014-03-22 00:45 PDT, Gyuyoung Kim
no flags
Patch (1.50 KB, patch)
2014-03-22 08:38 PDT, Gyuyoung Kim
no flags
Gyuyoung Kim
Comment 1 2014-03-22 00:45:47 PDT
Chris Dumez
Comment 2 2014-03-22 05:52:32 PDT
Comment on attachment 227538 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=227538&action=review > Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h:46 > + ~NavigatorContentUtils(); The destructor *is* virtual as RefCountedSupplement has a virtual destructor. I don't think it is a good idea to remove virtual here as it makes it less obvious the destructor really is virtual.
Gyuyoung Kim
Comment 3 2014-03-22 06:23:03 PDT
(In reply to comment #2) > (From update of attachment 227538 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=227538&action=review > > > Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h:46 > > + ~NavigatorContentUtils(); > > The destructor *is* virtual as RefCountedSupplement has a virtual destructor. I don't think it is a good idea to remove virtual here as it makes it less obvious the destructor really is virtual. I see. Do you think *final* keyword is not good as well ? I think NavigatorContentUtils won't become a parent class.
Chris Dumez
Comment 4 2014-03-22 06:44:35 PDT
Comment on attachment 227538 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=227538&action=review >>> Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h:46 >>> + ~NavigatorContentUtils(); >> >> The destructor *is* virtual as RefCountedSupplement has a virtual destructor. I don't think it is a good idea to remove virtual here as it makes it less obvious the destructor really is virtual. > > I see. Do you think *final* keyword is not good as well ? I think NavigatorContentUtils won't become a parent class. No, the final seems fine to me but I am not aware of the WebKit policy when it comes to final keyword.
Darin Adler
Comment 5 2014-03-22 07:52:24 PDT
Comment on attachment 227538 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=227538&action=review >>>> Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h:46 >>>> + ~NavigatorContentUtils(); >>> >>> The destructor *is* virtual as RefCountedSupplement has a virtual destructor. I don't think it is a good idea to remove virtual here as it makes it less obvious the destructor really is virtual. >> >> I see. Do you think *final* keyword is not good as well ? I think NavigatorContentUtils won't become a parent class. > > No, the final seems fine to me but I am not aware of the WebKit policy when it comes to final keyword. Yes, it’s fine to add final here and it’s wrong to remove virtual. In fact, I would approve patches adding virtual to destructors in cases like this. I don’t think there’s any benefit to adding final here, but it’s correct and not harmful.
Gyuyoung Kim
Comment 6 2014-03-22 08:38:40 PDT
Gyuyoung Kim
Comment 7 2014-03-22 08:41:25 PDT
I missed to virtual dtor in RefCountedSupplement. Sorry about it. Though it it not big benefit to add *final*, I also think it is correct. So, I update the patch again.
WebKit Commit Bot
Comment 8 2014-03-22 18:02:17 PDT
Comment on attachment 227551 [details] Patch Clearing flags on attachment: 227551 Committed r166130: <http://trac.webkit.org/changeset/166130>
WebKit Commit Bot
Comment 9 2014-03-22 18:02:23 PDT
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.