Make observers support weak references. Bug #18682; r=dp.

This commit is contained in:
scc%netscape.com 1999-12-07 14:06:36 +00:00
Родитель b62de0a844
Коммит f4ad22b9d9
24 изменённых файлов: 182 добавлений и 227 удалений

Просмотреть файл

@ -240,22 +240,26 @@ nsXMLContentSink::Init(nsIDocument* aDoc,
#ifndef XSL
NS_IMPL_ISUPPORTS3(nsXMLContentSink,
nsIXMLContentSink,
nsIContentSink,
nsIUnicharStreamLoaderObserver)
NS_IMPL_ADDREF(nsXMLContentSink)
NS_IMPL_RELEASE(nsXMLContentSink)
#else
NS_IMPL_THREADSAFE_ADDREF(nsXMLContentSink)
NS_IMPL_THREADSAFE_RELEASE(nsXMLContentSink)
NS_IMPL_QUERY_INTERFACE4(nsXMLContentSink,
nsIXMLContentSink,
nsIContentSink,
nsIObserver,
nsIUnicharStreamLoaderObserver)
#endif
NS_INTERFACE_MAP_BEGIN(nsXMLContentSink)
NS_INTERFACE_MAP_ENTRY(nsIXMLContentSink)
#ifdef XSL
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
#endif
NS_INTERFACE_MAP_ENTRY(nsIUnicharStreamLoaderObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXMLContentSink)
NS_INTERFACE_MAP_END
// nsIContentSink
NS_IMETHODIMP
nsXMLContentSink::WillBuildModel(void)

Просмотреть файл

@ -28,6 +28,7 @@
#include "nsIScrollableView.h"
#ifdef XSL
#include "nsIObserver.h"
#include "nsWeakReference.h"
#include "nsITransformMediator.h"
#endif
#include "nsIUnicharInputStream.h"
@ -56,6 +57,7 @@ typedef enum {
class nsXMLContentSink : public nsIXMLContentSink,
#ifdef XSL
public nsIObserver,
public nsSupportsWeakReference,
#endif
public nsIUnicharStreamLoaderObserver
{

Просмотреть файл

@ -26,6 +26,7 @@
#include "nsIFactory.h"
#include "nsIElementObserver.h"
#include "nsIObserver.h"
#include "nsWeakReference.h"
// {E12F6997-F28F-11d2-8ACE-00105A1B8860}
@ -34,7 +35,11 @@
class nsPICSElementObserver : public nsIElementObserver, public nsIObserver {
class nsPICSElementObserver
: public nsIElementObserver,
public nsIObserver,
public nsSupportsWeakReference
{
public:
nsPICSElementObserver();

Просмотреть файл

@ -57,7 +57,25 @@ static NS_DEFINE_IID(kPICSCID, NS_PICS_CID);
NS_IMPL_ADDREF(nsPICSElementObserver) \
NS_IMPL_RELEASE(nsPICSElementObserver)
NS_IMPL_RELEASE(nsPICSElementObserver)
NS_INTERFACE_MAP_BEGIN(nsPICSElementObserver)
/*
Slight problem here: there is no |class nsIPICSElementObserver|,
so, this is a slightly un-orthodox entry, which will have to be
fixed before we could switch over to the table-driven mechanism.
*/
if ( aIID.Equals(kIPICSElementObserverIID) )
foundInterface = NS_STATIC_CAST(nsIElementObserver*, this);
else
NS_INTERFACE_MAP_ENTRY(nsIElementObserver)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIElementObserver)
NS_INTERFACE_MAP_END
NS_PICS nsresult NS_NewPICSElementObserver(nsIObserver** anObserver)
{
@ -85,38 +103,6 @@ nsPICSElementObserver::~nsPICSElementObserver(void)
}
NS_IMETHODIMP nsPICSElementObserver::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if( NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
*aInstancePtr = NULL;
if( aIID.Equals ( kIPICSElementObserverIID )) {
*aInstancePtr = (void*) ((nsIElementObserver*) this);
NS_ADDREF_THIS();
return NS_OK;
}
if( aIID.Equals ( kIElementObserverIID )) {
*aInstancePtr = (void*) ((nsIElementObserver*) this);
NS_ADDREF_THIS();
return NS_OK;
}
if( aIID.Equals ( kIObserverIID )) {
*aInstancePtr = (void*) ((nsIObserver*) this);
NS_ADDREF_THIS();
return NS_OK;
}
if( aIID.Equals ( kISupportsIID )) {
*aInstancePtr = (void*) (this);
NS_ADDREF_THIS();
return NS_OK;
}
return NS_NOINTERFACE;
}
const char* nsPICSElementObserver::GetTagNameAt(PRUint32 aTagIndex)
{
if (aTagIndex == 0) {

Просмотреть файл

@ -55,35 +55,27 @@ nsWalletlibService::~nsWalletlibService()
{
}
NS_IMETHODIMP
nsWalletlibService::QueryInterface(REFNSIID iid, void** result)
{
if (! result) {
return NS_ERROR_NULL_POINTER;
}
*result = nsnull;
if (iid.Equals(NS_GET_IID(nsISupports)) || iid.Equals(kIWalletServiceIID)) {
*result = NS_STATIC_CAST(nsIWalletService*, this);
AddRef();
return NS_OK;
}
if (iid.Equals(kIFormSubmitObserverIID)) {
*result = NS_STATIC_CAST(nsIFormSubmitObserver*, this);
AddRef();
return NS_OK;
}
if (iid.Equals(nsIDocumentLoaderObserver::GetIID())) {
*result = (void*) ((nsIDocumentLoaderObserver*)this);
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMPL_ADDREF(nsWalletlibService);
NS_IMPL_RELEASE(nsWalletlibService);
NS_INTERFACE_MAP_BEGIN(nsWalletlibService)
NS_INTERFACE_MAP_ENTRY(nsIWalletService)
/*
Note: although this class always inherited from |nsIObserver|,
|QueryInterface| didn't previously respond to this request.
Now it does.
*/
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsIFormSubmitObserver)
NS_INTERFACE_MAP_ENTRY(nsIDocumentLoaderObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWalletService)
NS_INTERFACE_MAP_END
NS_IMETHODIMP nsWalletlibService::WALLET_PreEdit(nsAutoString& walletList) {
::WLLT_PreEdit(walletList);
return NS_OK;

Просмотреть файл

@ -27,11 +27,13 @@
#include "nsIObserver.h"
#include "nsIFormSubmitObserver.h"
#include "nsIDocumentLoaderObserver.h"
#include "nsWeakReference.h"
class nsWalletlibService : public nsIWalletService,
public nsIObserver,
public nsIFormSubmitObserver,
public nsIDocumentLoaderObserver {
public nsIDocumentLoaderObserver,
public nsSupportsWeakReference {
public:
NS_DECL_ISUPPORTS

Просмотреть файл

@ -125,39 +125,18 @@ NS_IMPL_ADDREF(mozXMLTerminal)
NS_IMPL_RELEASE(mozXMLTerminal)
NS_IMETHODIMP
mozXMLTerminal::QueryInterface(REFNSIID aIID,void** aInstancePtr)
{
if (aInstancePtr == NULL) {
return NS_ERROR_NULL_POINTER;
}
// Always NULL result, in case of failure
*aInstancePtr = NULL;
if ( aIID.Equals(kISupportsIID)) {
*aInstancePtr = NS_STATIC_CAST(nsISupports*,
NS_STATIC_CAST(mozIXMLTerminal*,this));
} else if ( aIID.Equals(mozIXMLTerminal::GetIID()) ) {
*aInstancePtr = NS_STATIC_CAST(mozIXMLTerminal*,this);
} else if (aIID.Equals(nsIDocumentLoaderObserver::GetIID())) {
*aInstancePtr = NS_STATIC_CAST(nsIDocumentLoaderObserver*,this);
} else if (aIID.Equals(nsIObserver::GetIID())) {
*aInstancePtr = NS_STATIC_CAST(nsIObserver*,this);
} else {
return NS_ERROR_NO_INTERFACE;
}
NS_ADDREF_THIS();
XMLT_LOG(mozXMLTerminal::QueryInterface,20,("mRefCnt = %d\n", mRefCnt));
return NS_OK;
}
NS_INTERFACE_MAP_BEGIN(mozXMLTerminal)
/*
I maintained the order from the original, however,
the original called |XMLT_LOG| and in the interface-map form
it no longer does. Is this an issue?
*/
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, mozIXMLTerminal)
NS_INTERFACE_MAP_ENTRY(mozIXMLTerminal)
NS_INTERFACE_MAP_ENTRY(nsIDocumentLoaderObserver)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END
NS_IMETHODIMP mozXMLTerminal::GetCurrentEntryNumber(PRInt32 *aNumber)

Просмотреть файл

@ -25,6 +25,7 @@
#include "nscore.h"
#include "nspr.h"
#include "nsCOMPtr.h"
#include "nsWeakReference.h"
#include "nsString.h"
#include "mozXMLT.h"
@ -38,7 +39,8 @@
class mozXMLTerminal : public mozIXMLTerminal,
public nsIDocumentLoaderObserver,
public nsIObserver
public nsIObserver,
public nsSupportsWeakReference
{
public:

Просмотреть файл

@ -32,6 +32,7 @@
#include "nsCharDetDll.h"
#include "nsIServiceManager.h"
#include "nsObserverBase.h"
#include "nsWeakReference.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -43,7 +44,8 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
class nsMetaCharsetObserver: public nsIElementObserver,
public nsIObserver,
public nsObserverBase,
public nsIMetaCharsetService {
public nsIMetaCharsetService,
public nsSupportsWeakReference {
NS_DECL_ISUPPORTS
@ -110,39 +112,13 @@ nsMetaCharsetObserver::~nsMetaCharsetObserver()
NS_IMPL_ADDREF ( nsMetaCharsetObserver );
NS_IMPL_RELEASE ( nsMetaCharsetObserver );
//-------------------------------------------------------------------------
NS_IMETHODIMP nsMetaCharsetObserver::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if( NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
*aInstancePtr = NULL;
if( aIID.Equals ( nsIElementObserver::GetIID() )) {
*aInstancePtr = (void*) ((nsIElementObserver*) this);
NS_ADDREF_THIS();
return NS_OK;
}
if( aIID.Equals ( nsIObserver::GetIID() )) {
*aInstancePtr = (void*) ((nsIObserver*) this);
NS_ADDREF_THIS();
return NS_OK;
}
if( aIID.Equals ( nsIMetaCharsetService::GetIID() )) {
*aInstancePtr = (void*) ((nsIMetaCharsetService*) this);
NS_ADDREF_THIS();
return NS_OK;
}
if( aIID.Equals ( kISupportsIID )) {
*aInstancePtr = (void*) ( this );
NS_ADDREF_THIS();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_INTERFACE_MAP_BEGIN(nsMetaCharsetObserver)
NS_INTERFACE_MAP_ENTRY(nsIElementObserver)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsIMetaCharsetService)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIElementObserver)
NS_INTERFACE_MAP_END
//-------------------------------------------------------------------------
NS_IMETHODIMP_(const char*) nsMetaCharsetObserver::GetTagNameAt(PRUint32 aTagIndex)

Просмотреть файл

@ -32,6 +32,7 @@
#include "nsCharDetDll.h"
#include "nsIServiceManager.h"
#include "nsObserverBase.h"
#include "nsWeakReference.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -43,7 +44,8 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
class nsXMLEncodingObserver: public nsIElementObserver,
public nsIObserver,
public nsObserverBase,
public nsIXMLEncodingService {
public nsIXMLEncodingService,
public nsSupportsWeakReference {
NS_DECL_ISUPPORTS
@ -100,39 +102,13 @@ nsXMLEncodingObserver::~nsXMLEncodingObserver()
NS_IMPL_ADDREF ( nsXMLEncodingObserver );
NS_IMPL_RELEASE ( nsXMLEncodingObserver );
//-------------------------------------------------------------------------
NS_IMETHODIMP nsXMLEncodingObserver::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if( NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
*aInstancePtr = NULL;
if( aIID.Equals ( nsIElementObserver::GetIID() )) {
*aInstancePtr = (void*) ((nsIElementObserver*) this);
NS_ADDREF_THIS();
return NS_OK;
}
if( aIID.Equals ( nsIObserver::GetIID() )) {
*aInstancePtr = (void*) ((nsIObserver*) this);
NS_ADDREF_THIS();
return NS_OK;
}
if( aIID.Equals ( nsIXMLEncodingService::GetIID() )) {
*aInstancePtr = (void*) ((nsIXMLEncodingService*) this);
NS_ADDREF_THIS();
return NS_OK;
}
if( aIID.Equals ( kISupportsIID )) {
*aInstancePtr = (void*) ( this );
NS_ADDREF_THIS();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_INTERFACE_MAP_BEGIN(nsXMLEncodingObserver)
NS_INTERFACE_MAP_ENTRY(nsIElementObserver)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsIXMLEncodingService)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIElementObserver)
NS_INTERFACE_MAP_END
//-------------------------------------------------------------------------
NS_IMETHODIMP_(const char*) nsXMLEncodingObserver::GetTagNameAt(PRUint32 aTagIndex)

Просмотреть файл

@ -240,22 +240,26 @@ nsXMLContentSink::Init(nsIDocument* aDoc,
#ifndef XSL
NS_IMPL_ISUPPORTS3(nsXMLContentSink,
nsIXMLContentSink,
nsIContentSink,
nsIUnicharStreamLoaderObserver)
NS_IMPL_ADDREF(nsXMLContentSink)
NS_IMPL_RELEASE(nsXMLContentSink)
#else
NS_IMPL_THREADSAFE_ADDREF(nsXMLContentSink)
NS_IMPL_THREADSAFE_RELEASE(nsXMLContentSink)
NS_IMPL_QUERY_INTERFACE4(nsXMLContentSink,
nsIXMLContentSink,
nsIContentSink,
nsIObserver,
nsIUnicharStreamLoaderObserver)
#endif
NS_INTERFACE_MAP_BEGIN(nsXMLContentSink)
NS_INTERFACE_MAP_ENTRY(nsIXMLContentSink)
#ifdef XSL
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
#endif
NS_INTERFACE_MAP_ENTRY(nsIUnicharStreamLoaderObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXMLContentSink)
NS_INTERFACE_MAP_END
// nsIContentSink
NS_IMETHODIMP
nsXMLContentSink::WillBuildModel(void)

Просмотреть файл

@ -28,6 +28,7 @@
#include "nsIScrollableView.h"
#ifdef XSL
#include "nsIObserver.h"
#include "nsWeakReference.h"
#include "nsITransformMediator.h"
#endif
#include "nsIUnicharInputStream.h"
@ -56,6 +57,7 @@ typedef enum {
class nsXMLContentSink : public nsIXMLContentSink,
#ifdef XSL
public nsIObserver,
public nsSupportsWeakReference,
#endif
public nsIUnicharStreamLoaderObserver
{

Просмотреть файл

@ -341,7 +341,7 @@ typedef struct _findAccountByKeyEntry {
NS_IMPL_ISUPPORTS2(nsMsgAccountManager, nsIMsgAccountManager, nsIObserver)
NS_IMPL_ISUPPORTS3(nsMsgAccountManager, nsIMsgAccountManager, nsIObserver, nsISupportsWeakReference)
nsMsgAccountManager::nsMsgAccountManager() :
m_accountsLoaded(PR_FALSE),

Просмотреть файл

@ -28,6 +28,7 @@
#include "nsIPref.h"
#include "nsIMsgFolderCache.h"
#include "nsIObserver.h"
#include "nsWeakReference.h"
/*
* some platforms (like Windows and Mac) use a map file, because of
@ -61,7 +62,10 @@
#define HAVE_MOVEMAIL 1
#endif /* HAVE_MOVEMAIL */
class nsMsgAccountManager : public nsIMsgAccountManager, public nsIObserver
class nsMsgAccountManager
: public nsIMsgAccountManager,
public nsIObserver,
public nsSupportsWeakReference
{
public:

Просмотреть файл

@ -28,7 +28,7 @@
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
NS_IMPL_ISUPPORTS3(nsMsgBiffManager, nsIMsgBiffManager, nsIIncomingServerListener, nsIObserver)
NS_IMPL_ISUPPORTS4(nsMsgBiffManager, nsIMsgBiffManager, nsIIncomingServerListener, nsIObserver, nsISupportsWeakReference)
void OnBiffTimer(nsITimer *timer, void *aBiffManager)
{

Просмотреть файл

@ -32,6 +32,7 @@
#include "nsCOMPtr.h"
#include "nsIIncomingServerListener.h"
#include "nsIObserver.h"
#include "nsWeakReference.h"
typedef struct {
nsCOMPtr<nsIMsgIncomingServer> server;
@ -39,7 +40,11 @@ typedef struct {
} nsBiffEntry;
class nsMsgBiffManager: public nsIMsgBiffManager, public nsIIncomingServerListener, public nsIObserver
class nsMsgBiffManager
: public nsIMsgBiffManager,
public nsIIncomingServerListener,
public nsIObserver,
public nsSupportsWeakReference
{
public:
nsMsgBiffManager();

Просмотреть файл

@ -77,32 +77,14 @@ void nsMsgRDFDataSource::Close()
NS_IMPL_ADDREF(nsMsgRDFDataSource)
NS_IMPL_RELEASE(nsMsgRDFDataSource)
nsresult
nsMsgRDFDataSource::QueryInterface(const nsIID& iid, void **result)
{
nsresult rv = NS_NOINTERFACE;
if (! result)
return NS_ERROR_NULL_POINTER;
void *res=nsnull;
if (iid.Equals(nsCOMTypeInfo<nsIRDFDataSource>::GetIID()) ||
iid.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
res = NS_STATIC_CAST(nsIRDFDataSource*, this);
else if(iid.Equals(nsCOMTypeInfo<nsIObserver>::GetIID()))
res = NS_STATIC_CAST(nsIObserver*, this);
else if(iid.Equals(nsCOMTypeInfo<nsIMsgRDFDataSource>::GetIID()))
res = NS_STATIC_CAST(nsIMsgRDFDataSource*, this);
if (res) {
NS_ADDREF(this);
*result = res;
rv = NS_OK;
}
return rv;
}
NS_INTERFACE_MAP_BEGIN(nsMsgRDFDataSource)
NS_INTERFACE_MAP_ENTRY(nsIRDFDataSource)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsIMsgRDFDataSource)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIRDFDataSource)
NS_INTERFACE_MAP_END
/* readonly attribute string URI; */

Просмотреть файл

@ -33,9 +33,11 @@
#include "nsITransactionManager.h"
#include "nsIMsgWindow.h"
#include "nsIMsgRDFDataSource.h"
#include "nsWeakReference.h"
class nsMsgRDFDataSource : public nsIRDFDataSource,
public nsIObserver,
public nsSupportsWeakReference,
public nsIMsgRDFDataSource
{
public:

Просмотреть файл

@ -58,7 +58,16 @@ nsFtpProtocolHandler::~nsFtpProtocolHandler() {
PR_LOG(gFTPLog, PR_LOG_ALWAYS, ("~nsFtpProtocolHandler() called"));
}
NS_IMPL_ISUPPORTS3(nsFtpProtocolHandler, nsIProtocolHandler, nsIConnectionCache, nsIObserver);
NS_IMPL_ADDREF(nsFtpProtocolHandler)
NS_IMPL_RELEASE(nsFtpProtocolHandler)
NS_INTERFACE_MAP_BEGIN(nsFtpProtocolHandler)
NS_INTERFACE_MAP_ENTRY(nsIProtocolHandler)
NS_INTERFACE_MAP_ENTRY(nsIConnectionCache)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIProtocolHandler)
NS_INTERFACE_MAP_END
NS_METHOD
nsFtpProtocolHandler::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult)

Просмотреть файл

@ -32,6 +32,7 @@
#include "nsIThreadPool.h"
#include "nsIObserverService.h"
#include "nsIObserver.h"
#include "nsWeakReference.h"
// {25029490-F132-11d2-9588-00805F369F95}
#define NS_FTPPROTOCOLHANDLER_CID \
@ -39,7 +40,8 @@
class nsFtpProtocolHandler : public nsIProtocolHandler,
public nsIConnectionCache,
public nsIObserver
public nsIObserver,
public nsSupportsWeakReference
{
public:
NS_DECL_ISUPPORTS

Просмотреть файл

@ -29,6 +29,7 @@
#include "nsString.h"
#include "prprf.h"
#include <iostream.h>
#include "nsWeakReference.h"
static nsIObserverService *anObserverService = NULL;
@ -48,7 +49,7 @@ extern ostream &operator<<( ostream &s, nsString &str ) {
return s;
}
class TestObserver : public nsIObserver {
class TestObserver : public nsIObserver, public nsSupportsWeakReference {
public:
TestObserver( const nsString &name = "unknown" )
: mName( name ) {
@ -60,7 +61,7 @@ public:
nsString mName;
};
NS_IMPL_ISUPPORTS( TestObserver, NS_GET_IID(nsIObserver) );
NS_IMPL_ISUPPORTS2( TestObserver, nsIObserver, nsISupportsWeakReference );
NS_IMETHODIMP
TestObserver::Observe( nsISupports *aSubject,

Просмотреть файл

@ -30,6 +30,7 @@
#include "nsIEventQueueService.h"
#include "nsIObserverService.h"
#include "nsIObserver.h"
#include "nsWeakReference.h"
#include "nsXPComFactory.h" /* template implementation of a XPCOM factory */
#include "nsITimer.h"
@ -103,7 +104,8 @@ static char *gEQActivatedNotification = "nsIEventQueueActivated";
static char *gEQDestroyedNotification = "nsIEventQueueDestroyed";
class nsAppShellService : public nsIAppShellService,
public nsIObserver
public nsIObserver,
public nsSupportsWeakReference
{
public:
nsAppShellService(void);
@ -173,7 +175,15 @@ nsAppShellService::~nsAppShellService()
/*
* Implement the nsISupports methods...
*/
NS_IMPL_ISUPPORTS2(nsAppShellService, nsIAppShellService, nsIObserver);
NS_IMPL_ADDREF(nsAppShellService)
NS_IMPL_RELEASE(nsAppShellService)
NS_INTERFACE_MAP_BEGIN(nsAppShellService)
NS_INTERFACE_MAP_ENTRY(nsIAppShellService)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAppShellService)
NS_INTERFACE_MAP_END
NS_IMETHODIMP

Просмотреть файл

@ -165,16 +165,17 @@ nsBrowserAppCore::~nsBrowserAppCore()
NS_IF_RELEASE(mSHistory);
}
NS_IMPL_ADDREF(nsBrowserAppCore)
NS_IMPL_RELEASE(nsBrowserAppCore)
NS_IMPL_ADDREF(nsBrowserInstance)
NS_IMPL_RELEASE(nsBrowserInstance)
NS_IMPL_QUERY_HEAD(nsBrowserAppCore)
NS_IMPL_QUERY_BODY(nsIBrowserInstance)
NS_IMPL_QUERY_BODY(nsIDocumentLoaderObserver)
NS_IMPL_QUERY_BODY(nsIObserver)
NS_IMPL_QUERY_BODY(nsIURIContentListener)
NS_IMPL_QUERY_TAIL(nsIBrowserInstance)
NS_INTERFACE_MAP_BEGIN(nsBrowserInstance)
NS_INTERFACE_MAP_ENTRY(nsIBrowserInstance)
NS_INTERFACE_MAP_ENTRY(nsIDocumentLoaderObserver)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsIURIContentListener)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIURIContentListener)
NS_INTERFACE_MAP_END
static
@ -948,7 +949,7 @@ nsBrowserAppCore::LoadUrl(const PRUnichar *aUrl)
#ifdef DEBUG
#include "nsProxyObjectManager.h"
class PageCycler : public nsIObserver {
class PageCycler : public nsIObserver, public nsSupportsWeakReference {
public:
NS_DECL_ISUPPORTS
@ -1059,7 +1060,14 @@ protected:
nsAutoString mLastRequest;
};
NS_IMPL_ISUPPORTS1(PageCycler, nsIObserver);
NS_IMPL_ADDREF(PageCycler)
NS_IMPL_RELEASE(PageCycler)
NS_INTERFACE_MAP_BEGIN(PageCycler)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver)
NS_INTERFACE_MAP_END
#endif

Просмотреть файл

@ -28,6 +28,7 @@
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsWeakReference.h"
#include "nsString.h"
#include "nsISupports.h"
@ -60,7 +61,8 @@ class nsBrowserInstance : public nsIBrowserInstance,
public nsIDocumentLoaderObserver,
public nsIObserver,
public nsISessionHistory,
public nsIURIContentListener {
public nsIURIContentListener,
public nsSupportsWeakReference {
public:
nsBrowserInstance();