Skip to content

Commit 0c7c3a2

Browse files
author
bryner%brianryner.com
committed
Bug 229875 - eliminate unnecssary public/virtual destructors. This patch changes all refcounted classes under xpcom/, which aren't inherited from or used on the stack, to have private, nonvirtual destructors. r=dougt, sr=dbaron.
1 parent 0393757 commit 0c7c3a2

File tree

93 files changed

+305
-272
lines changed

Some content is hidden

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

93 files changed

+305
-272
lines changed

xpcom/base/nsConsoleMessage.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ nsConsoleMessage::nsConsoleMessage(const PRUnichar *message)
5353
mMessage.Assign(message);
5454
}
5555

56-
nsConsoleMessage::~nsConsoleMessage() {}
57-
5856
NS_IMETHODIMP
5957
nsConsoleMessage::GetMessage(PRUnichar **result) {
6058
*result = ToNewUnicode(mMessage);

xpcom/base/nsConsoleMessage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ class nsConsoleMessage : public nsIConsoleMessage {
4646
nsConsoleMessage();
4747
nsConsoleMessage(const PRUnichar *message);
4848

49-
virtual ~nsConsoleMessage();
50-
5149
NS_DECL_ISUPPORTS
5250
NS_DECL_NSICONSOLEMESSAGE
5351

5452
private:
53+
~nsConsoleMessage() {}
54+
5555
nsString mMessage;
5656
};
5757

xpcom/base/nsConsoleService.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ class nsConsoleService : public nsIConsoleService
5252
{
5353
public:
5454
nsConsoleService();
55-
virtual ~nsConsoleService();
5655

5756
NS_DECL_ISUPPORTS
5857
NS_DECL_NSICONSOLESERVICE
5958

6059
private:
60+
~nsConsoleService();
61+
6162
// build (or find) a proxy for the listener
6263
nsresult GetProxyForListener(nsIConsoleListener* aListener,
6364
nsIConsoleListener** aProxy);

xpcom/base/nsDebugImpl.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ nsDebugImpl::nsDebugImpl()
148148
{
149149
}
150150

151-
nsDebugImpl::~nsDebugImpl()
152-
{
153-
}
154-
155151
/**
156152
* Implementation of the nsDebug methods. Note that this code is
157153
* always compiled in, in case some other module that uses it is

xpcom/base/nsDebugImpl.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ class nsDebugImpl : public nsIDebug
4343
NS_DECL_NSIDEBUG
4444

4545
nsDebugImpl();
46-
virtual ~nsDebugImpl();
4746
static NS_METHOD Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
47+
48+
private:
49+
~nsDebugImpl() {}
4850
};
4951

5052

xpcom/base/nsErrorService.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ class nsErrorService : public nsIErrorService
6262
NS_DECL_NSIERRORSERVICE
6363

6464
nsErrorService() {}
65-
virtual ~nsErrorService() {}
6665

6766
static NS_METHOD
6867
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
6968

69+
private:
70+
~nsErrorService() {}
71+
7072
protected:
7173
nsInt2StrHashtable mErrorStringBundleURLMap;
7274
nsInt2StrHashtable mErrorStringBundleKeyMap;

xpcom/base/nsExceptionService.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,16 @@ class nsExceptionManager : public nsIExceptionManager
7373
NS_DECL_NSIEXCEPTIONMANAGER
7474

7575
nsExceptionManager(nsExceptionService *svc);
76-
virtual ~nsExceptionManager();
7776
/* additional members */
7877
nsCOMPtr<nsIException> mCurrentException;
7978
nsExceptionManager *mNextThread; // not ref-counted.
8079
nsExceptionService *mService; // not ref-counted
8180
#ifdef NS_DEBUG
8281
static PRInt32 totalInstances;
8382
#endif
83+
84+
private:
85+
~nsExceptionManager();
8486
};
8587

8688

xpcom/base/nsExceptionService.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ class nsExceptionService : public nsIExceptionService, public nsIObserver
5858
NS_DECL_NSIOBSERVER
5959

6060
nsExceptionService();
61-
virtual ~nsExceptionService();
6261

6362
/* additional members */
6463
nsresult DoGetExceptionFromProvider(nsresult errCode,
@@ -86,6 +85,9 @@ class nsExceptionService : public nsIExceptionService, public nsIObserver
8685
#ifdef NS_DEBUG
8786
static PRInt32 totalInstances;
8887
#endif
88+
89+
private:
90+
~nsExceptionService();
8991
};
9092

9193

xpcom/base/nsLeakDetector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ static FILE* openTraceFile()
7575
class nsLeakDetector : public nsILeakDetector {
7676
public:
7777
nsLeakDetector();
78-
virtual ~nsLeakDetector();
7978

8079
NS_DECL_ISUPPORTS
8180
NS_DECL_NSILEAKDETECTOR
81+
private:
82+
~nsLeakDetector() {}
8283
};
8384

8485
NS_IMPL_ISUPPORTS1(nsLeakDetector, nsILeakDetector)
8586

8687
nsLeakDetector::nsLeakDetector() {
8788
}
88-
nsLeakDetector::~nsLeakDetector() {}
8989

9090
NS_METHOD nsLeakDetector::DumpLeaks()
9191
{

xpcom/base/nsMemoryImpl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,14 @@ class MemoryFlusher : public nsIRunnable
7777
PRCondVar* mCVar;
7878

7979
MemoryFlusher(nsMemoryImpl* aMemoryImpl);
80-
virtual ~MemoryFlusher();
8180

8281
enum {
8382
kInitialTimeout = 60 /*seconds*/
8483
};
8584

85+
private:
86+
~MemoryFlusher();
87+
8688
public:
8789
/**
8890
* Create a memory flusher.

0 commit comments

Comments
 (0)