From 9b1d14ae7e21b9568a880b04c36a0071ba061bde Mon Sep 17 00:00:00 2001 From: "warren%netscape.com" Date: Fri, 28 Aug 1998 21:47:44 +0000 Subject: [PATCH] Added class ID to OnShutdown. --- xpcom/components/nsServiceManager.cpp | 11 ++++++----- xpcom/src/nsIServiceManager.h | 2 +- xpcom/src/nsServiceManager.cpp | 11 ++++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/xpcom/components/nsServiceManager.cpp b/xpcom/components/nsServiceManager.cpp index 2a12d24f076e..cf72c6fe80eb 100644 --- a/xpcom/components/nsServiceManager.cpp +++ b/xpcom/components/nsServiceManager.cpp @@ -46,20 +46,21 @@ public: class nsServiceEntry { public: - nsServiceEntry(nsISupports* service); + nsServiceEntry(const nsCID& cid, nsISupports* service); ~nsServiceEntry(); nsresult AddListener(nsIShutdownListener* listener); nsresult RemoveListener(nsIShutdownListener* listener); nsresult NotifyListeners(void); + const nsCID& mClassID; nsISupports* mService; nsVector* mListeners; // nsVector }; -nsServiceEntry::nsServiceEntry(nsISupports* service) - : mService(service), mListeners(NULL) +nsServiceEntry::nsServiceEntry(const nsCID& cid, nsISupports* service) + : mClassID(cid), mService(service), mListeners(NULL) { } @@ -118,7 +119,7 @@ nsServiceEntry::NotifyListeners(void) PRUint32 size = mListeners->GetSize(); for (PRUint32 i = 0; i < size; i++) { nsIShutdownListener* listener = (nsIShutdownListener*)(*mListeners)[0]; - nsresult err = listener->OnShutdown(mService); + nsresult err = listener->OnShutdown(mClassID, mService); if (err) return err; listener->Release(); mListeners->Remove(0); @@ -227,7 +228,7 @@ nsServiceManager::GetService(const nsCID& aClass, const nsIID& aIID, nsISupports* service; err = NSRepository::CreateInstance(aClass, NULL, aIID, (void**)&service); if (err == NS_OK) { - entry = new nsServiceEntry(service); + entry = new nsServiceEntry(aClass, service); if (entry == NULL) { service->Release(); err = NS_ERROR_OUT_OF_MEMORY; diff --git a/xpcom/src/nsIServiceManager.h b/xpcom/src/nsIServiceManager.h index 1ac48c14102a..10b26986bce9 100644 --- a/xpcom/src/nsIServiceManager.h +++ b/xpcom/src/nsIServiceManager.h @@ -108,7 +108,7 @@ class nsIShutdownListener : public nsISupports { public: NS_IMETHOD - OnShutdown(nsISupports* service) = 0; + OnShutdown(const nsCID& aClass, nsISupports* service) = 0; }; diff --git a/xpcom/src/nsServiceManager.cpp b/xpcom/src/nsServiceManager.cpp index 2a12d24f076e..cf72c6fe80eb 100644 --- a/xpcom/src/nsServiceManager.cpp +++ b/xpcom/src/nsServiceManager.cpp @@ -46,20 +46,21 @@ public: class nsServiceEntry { public: - nsServiceEntry(nsISupports* service); + nsServiceEntry(const nsCID& cid, nsISupports* service); ~nsServiceEntry(); nsresult AddListener(nsIShutdownListener* listener); nsresult RemoveListener(nsIShutdownListener* listener); nsresult NotifyListeners(void); + const nsCID& mClassID; nsISupports* mService; nsVector* mListeners; // nsVector }; -nsServiceEntry::nsServiceEntry(nsISupports* service) - : mService(service), mListeners(NULL) +nsServiceEntry::nsServiceEntry(const nsCID& cid, nsISupports* service) + : mClassID(cid), mService(service), mListeners(NULL) { } @@ -118,7 +119,7 @@ nsServiceEntry::NotifyListeners(void) PRUint32 size = mListeners->GetSize(); for (PRUint32 i = 0; i < size; i++) { nsIShutdownListener* listener = (nsIShutdownListener*)(*mListeners)[0]; - nsresult err = listener->OnShutdown(mService); + nsresult err = listener->OnShutdown(mClassID, mService); if (err) return err; listener->Release(); mListeners->Remove(0); @@ -227,7 +228,7 @@ nsServiceManager::GetService(const nsCID& aClass, const nsIID& aIID, nsISupports* service; err = NSRepository::CreateInstance(aClass, NULL, aIID, (void**)&service); if (err == NS_OK) { - entry = new nsServiceEntry(service); + entry = new nsServiceEntry(aClass, service); if (entry == NULL) { service->Release(); err = NS_ERROR_OUT_OF_MEMORY;