Allows a QI from nsIServiceManager to nsIServiceManagerObsolete. b=105136, r=beard, sr=darin
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManagerObsolete.h"
|
||||
|
||||
nsServiceManagerObsolete* gServiceManagerObsolete = nsnull;
|
||||
#include "nsComponentManager.h"
|
||||
|
||||
extern PRBool gXPCOMShuttingDown;
|
||||
|
||||
@@ -13,24 +12,19 @@ nsServiceManager::GetGlobalServiceManager(nsIServiceManager* *result)
|
||||
if (gXPCOMShuttingDown)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
if (gServiceManagerObsolete) {
|
||||
*result = (nsIServiceManager*)(void*)gServiceManagerObsolete;
|
||||
return NS_OK;
|
||||
}
|
||||
if (nsComponentManagerImpl::gComponentManager == nsnull)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
gServiceManagerObsolete = new nsServiceManagerObsolete();
|
||||
if (!gServiceManagerObsolete)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*result = (nsIServiceManager*)(void*)gServiceManagerObsolete;
|
||||
// this method does not addref for historical reasons.
|
||||
// we return the nsIServiceManagerObsolete interface via a cast.
|
||||
*result = (nsIServiceManager*) NS_STATIC_CAST(nsIServiceManagerObsolete*,
|
||||
nsComponentManagerImpl::gComponentManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsServiceManager::ShutdownGlobalServiceManager(nsIServiceManager* *result)
|
||||
{
|
||||
delete gServiceManagerObsolete;
|
||||
gServiceManagerObsolete = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -39,10 +33,11 @@ nsServiceManager::GetService(const nsCID& aClass, const nsIID& aIID,
|
||||
nsISupports* *result,
|
||||
nsIShutdownListener* shutdownListener)
|
||||
{
|
||||
nsCOMPtr<nsIServiceManager> mgr;
|
||||
nsresult rv = NS_GetServiceManager(getter_AddRefs(mgr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return mgr->GetService(aClass, aIID, (void**)result);
|
||||
|
||||
if (nsComponentManagerImpl::gComponentManager == nsnull)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
return nsComponentManagerImpl::gComponentManager->GetService(aClass, aIID, (void**)result);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -56,19 +51,21 @@ nsServiceManager::ReleaseService(const nsCID& aClass, nsISupports* service,
|
||||
nsresult
|
||||
nsServiceManager::RegisterService(const nsCID& aClass, nsISupports* aService)
|
||||
{
|
||||
nsCOMPtr<nsIServiceManager> mgr;
|
||||
nsresult rv = NS_GetServiceManager(getter_AddRefs(mgr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;//mgr->RegisterService(aClass, aService);
|
||||
|
||||
if (nsComponentManagerImpl::gComponentManager == nsnull)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
return nsComponentManagerImpl::gComponentManager->RegisterService(aClass, aService);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsServiceManager::UnregisterService(const nsCID& aClass)
|
||||
{
|
||||
nsCOMPtr<nsIServiceManager> mgr;
|
||||
nsresult rv = NS_GetServiceManager(getter_AddRefs(mgr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;//mgr->UnregisterService(aClass);
|
||||
|
||||
if (nsComponentManagerImpl::gComponentManager == nsnull)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
return nsComponentManagerImpl::gComponentManager->UnregisterService(aClass);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -79,10 +76,11 @@ nsServiceManager::GetService(const char* aContractID, const nsIID& aIID,
|
||||
nsISupports* *result,
|
||||
nsIShutdownListener* shutdownListener)
|
||||
{
|
||||
nsCOMPtr<nsIServiceManager> mgr;
|
||||
nsresult rv = NS_GetServiceManager(getter_AddRefs(mgr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return mgr->GetServiceByContractID(aContractID, aIID, (void**)result);
|
||||
|
||||
if (nsComponentManagerImpl::gComponentManager == nsnull)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
return nsComponentManagerImpl::gComponentManager->GetServiceByContractID(aContractID, aIID, (void**)result);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -96,10 +94,11 @@ nsServiceManager::ReleaseService(const char* aContractID, nsISupports* service,
|
||||
nsresult
|
||||
nsServiceManager::RegisterService(const char* aContractID, nsISupports* aService)
|
||||
{
|
||||
nsCOMPtr<nsIServiceManager> mgr;
|
||||
nsresult rv = NS_GetServiceManager(getter_AddRefs(mgr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;//mgr->RegisterServiceByContractID(aContractID, aService);
|
||||
|
||||
if (nsComponentManagerImpl::gComponentManager == nsnull)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
return nsComponentManagerImpl::gComponentManager->RegisterService(aContractID, aService);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -110,70 +109,10 @@ nsServiceManager::UnregisterService(const char* aContractID)
|
||||
// destructor
|
||||
if (gXPCOMShuttingDown)
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsIServiceManager> mgr;
|
||||
nsresult rv = NS_GetServiceManager(getter_AddRefs(mgr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;//mgr->UnregisterServiceByContractID(aContractID);
|
||||
if (nsComponentManagerImpl::gComponentManager == nsnull)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
return nsComponentManagerImpl::gComponentManager->UnregisterService(aContractID);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsServiceManagerObsolete::nsServiceManagerObsolete() {
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
}
|
||||
nsServiceManagerObsolete::~nsServiceManagerObsolete() {
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsServiceManagerObsolete,
|
||||
nsIServiceManagerObsolete);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsServiceManagerObsolete::RegisterService(const nsCID& aClass, nsISupports* aService) {
|
||||
return nsServiceManager::RegisterService(aClass, aService);
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsServiceManagerObsolete::UnregisterService(const nsCID& aClass){
|
||||
return nsServiceManager::UnregisterService(aClass);
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsServiceManagerObsolete::GetService(const nsCID& aClass, const nsIID& aIID,
|
||||
nsISupports* *result,
|
||||
nsIShutdownListener* shutdownListener){
|
||||
return nsServiceManager::GetService(aClass, aIID, result, shutdownListener);
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsServiceManagerObsolete::ReleaseService(const nsCID& aClass, nsISupports* service,
|
||||
nsIShutdownListener* shutdownListener ){
|
||||
return nsServiceManager::ReleaseService(aClass, service, shutdownListener);
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsServiceManagerObsolete::RegisterService(const char* aContractID, nsISupports* aService){
|
||||
return nsServiceManager::RegisterService(aContractID, aService);
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsServiceManagerObsolete::UnregisterService(const char* aContractID){
|
||||
return nsServiceManager::UnregisterService(aContractID);
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsServiceManagerObsolete::GetService(const char* aContractID, const nsIID& aIID,
|
||||
nsISupports* *result,
|
||||
nsIShutdownListener* shutdownListener ){
|
||||
return nsServiceManager::GetService(aContractID, aIID, result, shutdownListener);
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsServiceManagerObsolete::ReleaseService(const char* aContractID, nsISupports* service,
|
||||
nsIShutdownListener* shutdownListener ){
|
||||
return nsServiceManager::ReleaseService(aContractID, service, shutdownListener);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user