Implementing access to servicemanager from component manager via

nsIInterfaceRequestor. r=scc
This commit is contained in:
dp%netscape.com 2000-01-11 22:54:46 +00:00
Родитель 5d32515178
Коммит 2df47b0c6d
2 изменённых файлов: 26 добавлений и 2 удалений

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

@ -317,7 +317,8 @@ nsComponentManagerImpl::~nsComponentManagerImpl()
PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS, ("nsComponentManager: Destroyed."));
}
NS_IMPL_ISUPPORTS2(nsComponentManagerImpl, nsIComponentManager, nsISupportsWeakReference)
NS_IMPL_ISUPPORTS3(nsComponentManagerImpl, nsIComponentManager,
nsISupportsWeakReference, nsIInterfaceRequestor)
////////////////////////////////////////////////////////////////////////////////
// nsComponentManagerImpl: Platform methods
@ -2241,6 +2242,25 @@ nsComponentManagerImpl::EnumerateProgIDs(nsIEnumerator** aEmumerator)
this, aEmumerator);
}
nsresult
nsComponentManagerImpl::GetInterface(const nsIID & uuid, void **result)
{
nsresult rv = NS_OK;
if (uuid.Equals(NS_GET_IID(nsIServiceManager)))
{
// Return the global service manager
rv = nsServiceManager::GetGlobalServiceManager((nsIServiceManager **)result);
}
else
{
// fall through to QI as anything QIable is a superset of what canbe
// got via the GetInterface()
rv = QueryInterface(uuid, result);
}
return rv;
}
////////////////////////////////////////////////////////////////////////////////
NS_COM nsresult

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

@ -28,6 +28,7 @@
#include "nsIComponentManager.h"
#include "nsIFactory.h"
#include "nsIRegistry.h"
#include "nsIInterfaceRequestor.h"
#include "nsHashtable.h"
#include "prtime.h"
#include "prmon.h"
@ -50,10 +51,13 @@ extern const char XPCOM_LIB_PREFIX[];
////////////////////////////////////////////////////////////////////////////////
class nsComponentManagerImpl : public nsIComponentManager, public nsSupportsWeakReference {
class nsComponentManagerImpl
: public nsIComponentManager, public nsSupportsWeakReference,
public nsIInterfaceRequestor {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICOMPONENTMANAGER
NS_DECL_NSIINTERFACEREQUESTOR
// nsComponentManagerImpl methods:
nsComponentManagerImpl();