BOOL CALLBACK GetnsISupportsProxyForUIThread(nsISupports *pMyThreadElement, nsISupports **ppUIThreadElement
, const nsIID &iid)
{
BOOL bRetValue = FALSE;
do
{
if(pMyThreadElement == NULL || ppUIThreadElement == NULL)
break;
nsCOMPtr<nsIServiceManager> Manager;
FF_CHECK_Result(NS_GetServiceManager(getter_AddRefs(Manager)));
FF_CHECK_COMPTR(Manager);
nsCOMPtr<nsIProxyObjectManager> pIProxyObjectManager;
FF_CHECK_Result(Manager->GetServiceByContractID("@mozilla.org/xpcomproxy;1", NS_GET_IID(nsIProxyObjectManager)
, getter_AddRefs(pIProxyObjectManager)));
FF_CHECK_Result(pIProxyObjectManager->GetProxyForObject((PROXY_PARAM1*)1, iid,
pMyThreadElement,NS_PROXY_SYNC | NS_PROXY_ALWAYS, (void**)ppUIThreadElement));
bRetValue = (*ppUIThreadElement != NULL);
} while(0);
return bRetValue;
}
本文介绍了一个名为GetnsISupportsProxyForUIThread的函数,该函数用于在多线程环境中为给定的对象获取一个可以在UI线程中使用的代理对象。通过调用nsIServiceManager和服务定位器等组件实现。
3万+

被折叠的 条评论
为什么被折叠?



