Skip to content

Commit 2fb29c9

Browse files
committedSep 6, 2018
Bug 1488684 - Made nsIFrame-derived classes and some others 'final' where possible - r=dbaron
All classes deriving from nsIFrame that did not have any subclasses themselves (at the time of writing this patch) have been marked with `final`. Some other Layout classes have also been made final, but this was opportunistic while working on nsIFrame subclasses, and is definitely not exhaustive, further patches welcome; refer to bug 1332680. Advantages of marking a class final include: - Allowing the compiler to devirtualize some method calls (i.e., calling virtual functions directly instead of going through the vtable), - Indicating that the class is not currently subclassed, - Preventing subclassing without being aware that this would remove the finalization benefits of the parent class. `final` does not signify that these classes should *never* be subclassed, this is left for developers to decide. Differential Revision: https://phabricator.services.mozilla.com/D5020
1 parent 9c3a820 commit 2fb29c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+123
-87
lines changed
 

‎layout/base/nsDocumentViewer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class AutoPrintEventDispatcher;
148148

149149
// a small delegate class used to avoid circular references
150150

151-
class nsDocViewerSelectionListener : public nsISelectionListener
151+
class nsDocViewerSelectionListener final : public nsISelectionListener
152152
{
153153
public:
154154

@@ -180,7 +180,7 @@ class nsDocViewerSelectionListener : public nsISelectionListener
180180

181181
/** editor Implementation of the FocusListener interface
182182
*/
183-
class nsDocViewerFocusListener : public nsIDOMEventListener
183+
class nsDocViewerFocusListener final : public nsIDOMEventListener
184184
{
185185
public:
186186
/** default constructor

‎layout/base/nsFrameTraversal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ nsresult NS_NewFrameTraversal(nsIFrameEnumerator **aEnumerator,
2222

2323
nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
2424

25-
class nsFrameTraversal : public nsIFrameTraversal
25+
class nsFrameTraversal final : public nsIFrameTraversal
2626
{
2727
public:
2828
nsFrameTraversal();

0 commit comments

Comments
 (0)
Failed to load comments.