XPCAutoLock lock(rt->GetMapLock()); XPCNativeInterface* iface2 = map->Add(iface); if(!iface2) { NS_ERROR("failed to add our interface!"); DestroyInstance(ccx, rt, iface); iface = nsnull; } else if(iface2 != iface) { DestroyInstance(ccx, rt, iface); iface = iface2; } }  return iface;
XPCAutoLock lock(mapLock);    XPCWrappedNative* wrapper2 = map->Add(wrapper); if(!wrapper2) { NS_ERROR("failed to add our wrapper!"); wrapperToKill = wrapper; wrapper = nsnull; } else if(wrapper2 != wrapper) { NS_ADDREF(wrapper2); wrapperToKill = wrapper; wrapper = wrapper2; } }  if(wrapperToKill) {  wrapperToKill->Release(); } else if(wrapper) {   XPCNativeScriptableInfo* si = wrapper->GetScriptableInfo(); if(si && si->GetFlags().WantPostCreate()) { si->GetCallback()-> PostCreate(wrapper, ccx, wrapper->GetFlatJSObject()); } }  if(!wrapper) return NS_ERROR_FAILURE;  DEBUG_CheckClassInfoClaims(wrapper); *resultWrapper = wrapper; return NS_OK;
XPCNativeInterface::GetNewOrUsed(XPCCallContext& ccx, nsIInterfaceInfo* info){    AutoMarkingNativeInterfacePtr iface(ccx);    const nsIID* iid;    if(NS_FAILED(info->GetIIDShared(&iid)) || !iid)        return nsnull;    XPCJSRuntime* rt = ccx.GetRuntime();    IID2NativeInterfaceMap* map = rt->GetIID2NativeInterfaceMap();    if(!map)        return nsnull;    {   // scoped lock        XPCAutoLock lock(rt->GetMapLock());        iface = map->Find(*iid);    }    if(iface)        return iface;    iface = NewInstance(ccx, info);    if(!iface)        return nsnull;    {   // scoped lock        XPCAutoLock lock(rt->GetMapLock());        XPCNativeInterface* iface2 = map->Add(iface);        if(!iface2)        {            NS_ERROR("failed to add our interface!");            DestroyInstance(ccx, rt, iface);            iface = nsnull;        }        else if(iface2 != iface)        {            DestroyInstance(ccx, rt, iface);            iface = iface2;        }    }    return iface;}