diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportMac.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportMac.cpp index da11a6106c3..60486bb2ab4 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportMac.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportMac.cpp @@ -30,6 +30,8 @@ class nsSplashScreenMac : public nsISplashScreen { public: + NS_DECL_ISUPPORTS + nsSplashScreenMac() : mDialog( 0 ), mPicHandle( 0 ), mRefCnt( 0 ) { } @@ -40,45 +42,12 @@ 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_ISUPPORTS1(nsSplashScreenMac, nsISplashScreen) + NS_IMETHODIMP nsSplashScreenMac::Show() { mDialog = ::GetNewDialog( rSplashDialog, nil, (WindowPtr)-1L ); @@ -128,4 +97,4 @@ PRBool NS_CanRun() return PR_FALSE; } return PR_TRUE; -} \ No newline at end of file +} diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportPh.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportPh.cpp index ab492f0870e..597d22f5650 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportPh.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportPh.cpp @@ -31,6 +31,8 @@ class nsSplashScreenPh : public nsISplashScreen { public: + NS_DECL_ISUPPORTS + nsSplashScreenPh() : mDialog( 0 ), mRefCnt( 0 ) { @@ -48,44 +50,11 @@ 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; - } - PtWidget_t *mDialog; - nsrefcnt mRefCnt; }; // class nsSplashScreenPh +NS_IMPL_ISUPPORTS1(nsSplashScreenPh, nsISplashScreen) + NS_IMETHODIMP nsSplashScreenPh::Show() { @@ -178,4 +147,4 @@ nsresult NS_CreateSplashScreen(nsISplashScreen**aResult) PRBool NS_CanRun() { return PR_TRUE; -} \ No newline at end of file +} diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp index 0b4addef5e1..6c5edcfd77e 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Netscape Public * License Version 1.1 (the "License"); you may not use this file @@ -30,46 +30,14 @@ 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 ); @@ -79,9 +47,10 @@ public: static DWORD WINAPI ThreadProc( LPVOID ); HWND mDlg; - nsrefcnt mRefCnt; }; // class nsSplashScreenWin +NS_IMPL_ISUPPORTS1(nsSplashScreenWin, nsISplashScreen) + nsSplashScreenWin::nsSplashScreenWin() : mRefCnt( 0 ), mDlg( 0 ) { } @@ -293,4 +262,4 @@ nsresult NS_CreateSplashScreen( nsISplashScreen **aResult ) { PRBool NS_CanRun() { return PR_TRUE; -} \ No newline at end of file +}