mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 04:20:56 +00:00
mshtml: COM cleanup for the nsIFactory iface.
This commit is contained in:
parent
95d8566a83
commit
a59cc1a630
|
@ -377,27 +377,28 @@ static const nsITooltipTextProviderVtbl nsTooltipTextProviderVtbl = {
|
|||
static nsITooltipTextProvider nsTooltipTextProvider = { &nsTooltipTextProviderVtbl };
|
||||
|
||||
typedef struct {
|
||||
const nsIFactoryVtbl *lpFactoryVtbl;
|
||||
nsIFactory nsIFactory_iface;
|
||||
nsISupports *service;
|
||||
} nsServiceFactory;
|
||||
|
||||
#define NSFACTORY(x) ((nsIFactory*) &(x)->lpFactoryVtbl)
|
||||
|
||||
#define NSFACTORY_THIS(iface) DEFINE_THIS(nsServiceFactory, Factory, iface)
|
||||
static inline nsServiceFactory *impl_from_nsIFactory(nsIFactory *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, nsServiceFactory, nsIFactory_iface);
|
||||
}
|
||||
|
||||
static nsresult NSAPI nsServiceFactory_QueryInterface(nsIFactory *iface, nsIIDRef riid,
|
||||
void **result)
|
||||
{
|
||||
nsServiceFactory *This = NSFACTORY_THIS(iface);
|
||||
nsServiceFactory *This = impl_from_nsIFactory(iface);
|
||||
|
||||
*result = NULL;
|
||||
|
||||
if(IsEqualGUID(&IID_nsISupports, riid)) {
|
||||
TRACE("(%p)->(IID_nsISupports %p)\n", This, result);
|
||||
*result = NSFACTORY(This);
|
||||
*result = &This->nsIFactory_iface;
|
||||
}else if(IsEqualGUID(&IID_nsIFactory, riid)) {
|
||||
TRACE("(%p)->(IID_nsIFactory %p)\n", This, result);
|
||||
*result = NSFACTORY(This);
|
||||
*result = &This->nsIFactory_iface;
|
||||
}
|
||||
|
||||
if(*result)
|
||||
|
@ -420,7 +421,7 @@ static nsrefcnt NSAPI nsServiceFactory_Release(nsIFactory *iface)
|
|||
static nsresult NSAPI nsServiceFactory_CreateInstance(nsIFactory *iface,
|
||||
nsISupports *aOuter, const nsIID *iid, void **result)
|
||||
{
|
||||
nsServiceFactory *This = NSFACTORY_THIS(iface);
|
||||
nsServiceFactory *This = impl_from_nsIFactory(iface);
|
||||
|
||||
TRACE("(%p)->(%p %s %p)\n", This, aOuter, debugstr_guid(iid), result);
|
||||
|
||||
|
@ -429,13 +430,11 @@ static nsresult NSAPI nsServiceFactory_CreateInstance(nsIFactory *iface,
|
|||
|
||||
static nsresult NSAPI nsServiceFactory_LockFactory(nsIFactory *iface, PRBool lock)
|
||||
{
|
||||
nsServiceFactory *This = NSFACTORY_THIS(iface);
|
||||
nsServiceFactory *This = impl_from_nsIFactory(iface);
|
||||
WARN("(%p)->(%x)\n", This, lock);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#undef NSFACTORY_THIS
|
||||
|
||||
static const nsIFactoryVtbl nsServiceFactoryVtbl = {
|
||||
nsServiceFactory_QueryInterface,
|
||||
nsServiceFactory_AddRef,
|
||||
|
@ -445,12 +444,12 @@ static const nsIFactoryVtbl nsServiceFactoryVtbl = {
|
|||
};
|
||||
|
||||
static nsServiceFactory nsPromptServiceFactory = {
|
||||
&nsServiceFactoryVtbl,
|
||||
{ &nsServiceFactoryVtbl },
|
||||
(nsISupports*)&nsPromptService
|
||||
};
|
||||
|
||||
static nsServiceFactory nsTooltipTextFactory = {
|
||||
&nsServiceFactoryVtbl,
|
||||
{ &nsServiceFactoryVtbl },
|
||||
(nsISupports*)&nsTooltipTextProvider
|
||||
};
|
||||
|
||||
|
@ -460,7 +459,7 @@ void register_nsservice(nsIComponentRegistrar *registrar, nsIServiceManager *ser
|
|||
nsresult nsres;
|
||||
|
||||
nsres = nsIComponentRegistrar_RegisterFactory(registrar, &NS_PROMPTSERVICE_CID,
|
||||
"Prompt Service", NS_PROMPTSERVICE_CONTRACTID, NSFACTORY(&nsPromptServiceFactory));
|
||||
"Prompt Service", NS_PROMPTSERVICE_CONTRACTID, &nsPromptServiceFactory.nsIFactory_iface);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("RegisterFactory failed: %08x\n", nsres);
|
||||
|
||||
|
@ -478,7 +477,7 @@ void register_nsservice(nsIComponentRegistrar *registrar, nsIServiceManager *ser
|
|||
|
||||
nsres = nsIComponentRegistrar_RegisterFactory(registrar, &NS_TOOLTIPTEXTPROVIDER_CID,
|
||||
NS_TOOLTIPTEXTPROVIDER_CLASSNAME, NS_TOOLTIPTEXTPROVIDER_CONTRACTID,
|
||||
NSFACTORY(&nsTooltipTextFactory));
|
||||
&nsTooltipTextFactory.nsIFactory_iface);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("RegisterFactory failed: %08x\n", nsres);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue