From 4b3daedbe501d01da3b1c097ca511dc193382d24 Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Wed, 11 Aug 1999 23:48:08 +0000 Subject: [PATCH] fix WeakReference exporting for Windows. a:chofmann r:scc. --- xpcom/base/nsIWeakReference.idl | 3 ++- xpcom/base/nsWeakReference.cpp | 12 ++++++------ xpcom/base/nsWeakReference.h | 7 +++---- xpcom/build/dlldeps.cpp | 2 ++ xpcom/glue/nsWeakReference.cpp | 12 ++++++------ xpcom/glue/nsWeakReference.h | 7 +++---- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/xpcom/base/nsIWeakReference.idl b/xpcom/base/nsIWeakReference.idl index 151511bd323..a153498db43 100644 --- a/xpcom/base/nsIWeakReference.idl +++ b/xpcom/base/nsIWeakReference.idl @@ -19,7 +19,8 @@ interface nsISupportsWeakReference : nsISupports // typedef nsCOMPtr nsWeakPtr; // ...this definition had to be moved to nsWeakPtr.h to avoid circular includes, sorry -nsIWeakReference* NS_GetWeakReference( nsISupports* , nsresult* aResult = 0); +extern NS_COM nsIWeakReference* +NS_GetWeakReference( nsISupports* , nsresult* aResult = 0); // ...convenience. Get a weak reference (if possible) without doing the query yourself template diff --git a/xpcom/base/nsWeakReference.cpp b/xpcom/base/nsWeakReference.cpp index 4f7acaf818a..2cb9ee95d4e 100644 --- a/xpcom/base/nsWeakReference.cpp +++ b/xpcom/base/nsWeakReference.cpp @@ -3,7 +3,7 @@ #include "nsWeakReference.h" #include "nsCOMPtr.h" -nsIWeakReference* +NS_COM nsIWeakReference * NS_GetWeakReference( nsISupports* aInstance, nsresult* aResult ) { nsresult status; @@ -18,7 +18,7 @@ NS_GetWeakReference( nsISupports* aInstance, nsresult* aResult ) return weakP; } -nsresult +NS_IMETHODIMP nsSupportsWeakReference::GetWeakReference( nsIWeakReference** aInstancePtr ) { if ( !aInstancePtr ) @@ -40,13 +40,13 @@ nsSupportsWeakReference::GetWeakReference( nsIWeakReference** aInstancePtr ) return status; } -nsrefcnt +NS_IMETHODIMP_(nsrefcnt) nsWeakReference::AddRef() { return ++mRefCount; } -nsrefcnt +NS_IMETHODIMP_(nsrefcnt) nsWeakReference::Release() { nsrefcnt temp = --mRefCount; @@ -55,7 +55,7 @@ nsWeakReference::Release() return temp; } -nsresult +NS_IMETHODIMP nsWeakReference::QueryInterface( const nsIID& aIID, void** aInstancePtr ) { if ( !aInstancePtr ) @@ -80,7 +80,7 @@ nsWeakReference::QueryInterface( const nsIID& aIID, void** aInstancePtr ) return status; } -nsresult +NS_IMETHODIMP nsWeakReference::QueryReference( const nsIID& aIID, void** aInstancePtr ) { return mReferent ? mReferent->QueryInterface(aIID, aInstancePtr) : NS_ERROR_NULL_POINTER; diff --git a/xpcom/base/nsWeakReference.h b/xpcom/base/nsWeakReference.h index 6a1b80542c7..c993f16a014 100644 --- a/xpcom/base/nsWeakReference.h +++ b/xpcom/base/nsWeakReference.h @@ -5,7 +5,7 @@ #include "nsIWeakReference.h" -class nsSupportsWeakReference : public nsISupportsWeakReference +class NS_COM nsSupportsWeakReference : public nsISupportsWeakReference { public: nsSupportsWeakReference() @@ -31,7 +31,7 @@ class nsSupportsWeakReference : public nsISupportsWeakReference nsWeakReference* mProxy; }; -class nsWeakReference : public nsIWeakReference +class NS_COM nsWeakReference : public nsIWeakReference { public: // nsISupports... @@ -72,8 +72,7 @@ class nsWeakReference : public nsIWeakReference nsSupportsWeakReference* mReferent; }; -inline -nsSupportsWeakReference::~nsSupportsWeakReference() +inline nsSupportsWeakReference::~nsSupportsWeakReference() { if ( mProxy ) mProxy->NoticeReferentDestruction(); diff --git a/xpcom/build/dlldeps.cpp b/xpcom/build/dlldeps.cpp index 90e551cb9a2..ccecc419520 100644 --- a/xpcom/build/dlldeps.cpp +++ b/xpcom/build/dlldeps.cpp @@ -45,6 +45,7 @@ #include "nsAVLTree.h" #include "nsHashtableEnumerator.h" #include "nsPipe2.h" +#include "nsWeakReference.h" class dummyComparitor: public nsAVLNodeComparitor { public: @@ -99,6 +100,7 @@ void XXXNeverCalled() XPTI_GetInterfaceInfoManager(); NS_NewGenericFactory(NULL, NULL, NULL); NS_NewHashtableEnumerator(NULL, NULL, NULL, NULL); + NS_GetWeakReference(NULL); #ifdef DEBUG TestSegmentedBuffer(); #endif diff --git a/xpcom/glue/nsWeakReference.cpp b/xpcom/glue/nsWeakReference.cpp index 4f7acaf818a..2cb9ee95d4e 100644 --- a/xpcom/glue/nsWeakReference.cpp +++ b/xpcom/glue/nsWeakReference.cpp @@ -3,7 +3,7 @@ #include "nsWeakReference.h" #include "nsCOMPtr.h" -nsIWeakReference* +NS_COM nsIWeakReference * NS_GetWeakReference( nsISupports* aInstance, nsresult* aResult ) { nsresult status; @@ -18,7 +18,7 @@ NS_GetWeakReference( nsISupports* aInstance, nsresult* aResult ) return weakP; } -nsresult +NS_IMETHODIMP nsSupportsWeakReference::GetWeakReference( nsIWeakReference** aInstancePtr ) { if ( !aInstancePtr ) @@ -40,13 +40,13 @@ nsSupportsWeakReference::GetWeakReference( nsIWeakReference** aInstancePtr ) return status; } -nsrefcnt +NS_IMETHODIMP_(nsrefcnt) nsWeakReference::AddRef() { return ++mRefCount; } -nsrefcnt +NS_IMETHODIMP_(nsrefcnt) nsWeakReference::Release() { nsrefcnt temp = --mRefCount; @@ -55,7 +55,7 @@ nsWeakReference::Release() return temp; } -nsresult +NS_IMETHODIMP nsWeakReference::QueryInterface( const nsIID& aIID, void** aInstancePtr ) { if ( !aInstancePtr ) @@ -80,7 +80,7 @@ nsWeakReference::QueryInterface( const nsIID& aIID, void** aInstancePtr ) return status; } -nsresult +NS_IMETHODIMP nsWeakReference::QueryReference( const nsIID& aIID, void** aInstancePtr ) { return mReferent ? mReferent->QueryInterface(aIID, aInstancePtr) : NS_ERROR_NULL_POINTER; diff --git a/xpcom/glue/nsWeakReference.h b/xpcom/glue/nsWeakReference.h index 6a1b80542c7..c993f16a014 100644 --- a/xpcom/glue/nsWeakReference.h +++ b/xpcom/glue/nsWeakReference.h @@ -5,7 +5,7 @@ #include "nsIWeakReference.h" -class nsSupportsWeakReference : public nsISupportsWeakReference +class NS_COM nsSupportsWeakReference : public nsISupportsWeakReference { public: nsSupportsWeakReference() @@ -31,7 +31,7 @@ class nsSupportsWeakReference : public nsISupportsWeakReference nsWeakReference* mProxy; }; -class nsWeakReference : public nsIWeakReference +class NS_COM nsWeakReference : public nsIWeakReference { public: // nsISupports... @@ -72,8 +72,7 @@ class nsWeakReference : public nsIWeakReference nsSupportsWeakReference* mReferent; }; -inline -nsSupportsWeakReference::~nsSupportsWeakReference() +inline nsSupportsWeakReference::~nsSupportsWeakReference() { if ( mProxy ) mProxy->NoticeReferentDestruction();