зеркало из https://github.com/mozilla/pjs.git
Bug #15292, r=dp. Made the component manager inherit from |nsSupportsWeakReference|, fixed its |QueryInterface()| appropriately, and added casts in two places that became ambiguous now that the component manager had multiple |nsISupports| in it. Now one can hold a weak reference to the component manager using |nsIWeakReference|.
This commit is contained in:
Родитель
579ee02412
Коммит
1b9183448d
|
@ -206,7 +206,7 @@ nsresult NS_COM NS_InitXPCOM(nsIServiceManager* *result,
|
||||||
nsComponentManagerImpl::gComponentManager = compMgr;
|
nsComponentManagerImpl::gComponentManager = compMgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = servMgr->RegisterService(kComponentManagerCID, compMgr);
|
rv = servMgr->RegisterService(kComponentManagerCID, NS_STATIC_CAST(nsIComponentManager*, compMgr));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
// 3. Register the global services with the component manager so that
|
// 3. Register the global services with the component manager so that
|
||||||
|
|
|
@ -290,7 +290,7 @@ nsComponentManagerImpl::~nsComponentManagerImpl()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsComponentManagerImpl, NS_GET_IID(nsIComponentManager));
|
NS_IMPL_ISUPPORTS2(nsComponentManagerImpl, nsIComponentManager, nsISupportsWeakReference)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// nsComponentManagerImpl: Platform methods
|
// nsComponentManagerImpl: Platform methods
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "prtime.h"
|
#include "prtime.h"
|
||||||
#include "prmon.h"
|
#include "prmon.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsWeakReference.h"
|
||||||
|
|
||||||
class nsFactoryEntry;
|
class nsFactoryEntry;
|
||||||
class nsDll;
|
class nsDll;
|
||||||
|
@ -44,7 +45,7 @@ extern const char XPCOM_LIB_PREFIX[];
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class nsComponentManagerImpl : public nsIComponentManager {
|
class nsComponentManagerImpl : public nsIComponentManager, public nsSupportsWeakReference {
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSICOMPONENTMANAGER
|
NS_DECL_NSICOMPONENTMANAGER
|
||||||
|
|
|
@ -365,7 +365,7 @@ nsFreeLibrary(nsDll *dll, nsIServiceManager *serviceMgr, PRInt32 when)
|
||||||
// Get the module object
|
// Get the module object
|
||||||
nsCOMPtr<nsIModule> mobj;
|
nsCOMPtr<nsIModule> mobj;
|
||||||
/* XXXshaver cheat and use the global component manager */
|
/* XXXshaver cheat and use the global component manager */
|
||||||
rv = dll->GetModule(nsComponentManagerImpl::gComponentManager,
|
rv = dll->GetModule(NS_STATIC_CAST(nsIComponentManager*, nsComponentManagerImpl::gComponentManager),
|
||||||
getter_AddRefs(mobj));
|
getter_AddRefs(mobj));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче