diff --git a/xpfe/bootstrap/nsNativeAppSupportGtk.cpp b/xpfe/bootstrap/nsNativeAppSupportGtk.cpp index efcaa1421205..4ef377557a8a 100644 --- a/xpfe/bootstrap/nsNativeAppSupportGtk.cpp +++ b/xpfe/bootstrap/nsNativeAppSupportGtk.cpp @@ -39,7 +39,7 @@ public: GdkWindow *mDialog; }; // class nsSplashScreenGtk -NS_IMPL_THREADSAFE_ISUPPORTS0(nsSplashScreenGtk) +NS_IMPL_ISUPPORTS0(nsSplashScreenGtk) nsSplashScreenGtk::nsSplashScreenGtk() { diff --git a/xpfe/bootstrap/nsNativeAppSupportMac.cpp b/xpfe/bootstrap/nsNativeAppSupportMac.cpp index eccc0122960e..938717c35db2 100644 --- a/xpfe/bootstrap/nsNativeAppSupportMac.cpp +++ b/xpfe/bootstrap/nsNativeAppSupportMac.cpp @@ -30,8 +30,6 @@ class nsSplashScreenMac : public nsISplashScreen { public: - NS_DECL_ISUPPORTS - nsSplashScreenMac() : mDialog( 0 ), mPicHandle( 0 ), mRefCnt( 0 ) { } @@ -42,12 +40,45 @@ public: NS_IMETHOD Show(); NS_IMETHOD Hide(); + // nsISupports methods + NS_IMETHOD_(nsrefcnt) AddRef() { + mRefCnt++; + return mRefCnt; + } + NS_IMETHOD_(nsrefcnt) Release() { + --mRefCnt; + if ( !mRefCnt ) { + delete this; + return 0; + } + return mRefCnt; + } + NS_IMETHOD QueryInterface( const nsIID &iid, void**p ) { + nsresult rv = NS_OK; + if ( p ) { + *p = 0; + if ( iid.Equals( NS_GET_IID( nsISplashScreen ) ) ) { + nsISplashScreen *result = this; + *p = result; + NS_ADDREF( result ); + } else if ( iid.Equals( NS_GET_IID( nsISupports ) ) ) { + nsISupports *result = NS_STATIC_CAST( nsISupports*, this ); + *p = result; + NS_ADDREF( result ); + } else { + rv = NS_NOINTERFACE; + } + } else { + rv = NS_ERROR_NULL_POINTER; + } + return rv; + } + DialogPtr mDialog; PicHandle mPicHandle; + nsrefcnt mRefCnt; }; // class nsSplashScreenMac -NS_IMPL_THREADSAFE_ISUPPORTS1(nsSplashScreenMac, nsISplashScreen) - NS_IMETHODIMP nsSplashScreenMac::Show() { mDialog = ::GetNewDialog( rSplashDialog, nil, (WindowPtr)-1L ); diff --git a/xpfe/bootstrap/nsNativeAppSupportPh.cpp b/xpfe/bootstrap/nsNativeAppSupportPh.cpp index c260eabd6c26..55ca6d9c1f36 100644 --- a/xpfe/bootstrap/nsNativeAppSupportPh.cpp +++ b/xpfe/bootstrap/nsNativeAppSupportPh.cpp @@ -31,8 +31,6 @@ class nsSplashScreenPh : public nsISplashScreen { public: - NS_DECL_ISUPPORTS - nsSplashScreenPh() : mDialog( 0 ), mRefCnt( 0 ) { @@ -50,10 +48,43 @@ public: NS_IMETHOD Show(); NS_IMETHOD Hide(); - PtWidget_t *mDialog; -}; // class nsSplashScreenPh + // nsISupports methods + NS_IMETHOD_(nsrefcnt) AddRef() { + mRefCnt++; + return mRefCnt; + } + NS_IMETHOD_(nsrefcnt) Release() { + --mRefCnt; + if ( !mRefCnt ) { + delete this; + return 0; + } + return mRefCnt; + } + NS_IMETHOD QueryInterface( const nsIID &iid, void**p ) { + nsresult rv = NS_OK; + if ( p ) { + *p = 0; + if ( iid.Equals( NS_GET_IID( nsISplashScreen ) ) ) { + nsISplashScreen *result = this; + *p = result; + NS_ADDREF( result ); + } else if ( iid.Equals( NS_GET_IID( nsISupports ) ) ) { + nsISupports *result = NS_STATIC_CAST( nsISupports*, this ); + *p = result; + NS_ADDREF( result ); + } else { + rv = NS_NOINTERFACE; + } + } else { + rv = NS_ERROR_NULL_POINTER; + } + return rv; + } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsSplashScreenPh, nsISplashScreen) + PtWidget_t *mDialog; + nsrefcnt mRefCnt; +}; // class nsSplashScreenPh NS_IMETHODIMP nsSplashScreenPh::Show() diff --git a/xpfe/bootstrap/nsNativeAppSupportWin.cpp b/xpfe/bootstrap/nsNativeAppSupportWin.cpp index 8864ab6ebd13..ef0accec67f3 100644 --- a/xpfe/bootstrap/nsNativeAppSupportWin.cpp +++ b/xpfe/bootstrap/nsNativeAppSupportWin.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * The contents of this file are subject to the Netscape Public * License Version 1.1 (the "License"); you may not use this file @@ -30,14 +30,46 @@ class nsSplashScreenWin : public nsISplashScreen { public: - NS_DECL_ISUPPORTS - nsSplashScreenWin(); ~nsSplashScreenWin(); NS_IMETHOD Show(); NS_IMETHOD Hide(); + // nsISupports methods + NS_IMETHOD_(nsrefcnt) AddRef() { + mRefCnt++; + return mRefCnt; + } + NS_IMETHOD_(nsrefcnt) Release() { + --mRefCnt; + if ( !mRefCnt ) { + delete this; + return 0; + } + return mRefCnt; + } + NS_IMETHOD QueryInterface( const nsIID &iid, void**p ) { + nsresult rv = NS_OK; + if ( p ) { + *p = 0; + if ( iid.Equals( NS_GET_IID( nsISplashScreen ) ) ) { + nsISplashScreen *result = this; + *p = result; + NS_ADDREF( result ); + } else if ( iid.Equals( NS_GET_IID( nsISupports ) ) ) { + nsISupports *result = NS_STATIC_CAST( nsISupports*, this ); + *p = result; + NS_ADDREF( result ); + } else { + rv = NS_NOINTERFACE; + } + } else { + rv = NS_ERROR_NULL_POINTER; + } + return rv; + } + void SetDialog( HWND dlg ); static void CheckConsole(); static nsSplashScreenWin* GetPointer( HWND dlg ); @@ -47,10 +79,9 @@ public: static DWORD WINAPI ThreadProc( LPVOID ); HWND mDlg; + nsrefcnt mRefCnt; }; // class nsSplashScreenWin -NS_IMPL_THREADSAFE_ISUPPORTS1(nsSplashScreenWin, nsISplashScreen) - nsSplashScreenWin::nsSplashScreenWin() : mRefCnt( 0 ), mDlg( 0 ) { }