Bug 1131797 part 2. Stop storing the XPCNativeInterface* in XPConnect function objects and just get it from the XPCNativeMember* we're still storing. r=bholley

This commit is contained in:
Boris Zbarsky 2015-03-03 07:12:01 -05:00
Родитель ff2c755d8f
Коммит b90fad0b12
2 изменённых файлов: 11 добавлений и 6 удалений

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

@ -26,11 +26,12 @@ XPCNativeMember::GetCallInfo(JSObject* funobj,
XPCNativeMember** pMember)
{
funobj = js::UncheckedUnwrap(funobj);
jsval ifaceVal = js::GetFunctionNativeReserved(funobj, 0);
jsval memberVal = js::GetFunctionNativeReserved(funobj, 1);
jsval memberVal =
js::GetFunctionNativeReserved(funobj,
XPC_FUNCTION_NATIVE_MEMBER_SLOT);
*pInterface = (XPCNativeInterface*) ifaceVal.toPrivate();
*pMember = (XPCNativeMember*) memberVal.toPrivate();
*pMember = static_cast<XPCNativeMember*>(memberVal.toPrivate());
*pInterface = (*pMember)->GetInterface();
return true;
}
@ -92,8 +93,8 @@ XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface,
if (!funobj)
return false;
js::SetFunctionNativeReserved(funobj, 0, PRIVATE_TO_JSVAL(iface));
js::SetFunctionNativeReserved(funobj, 1, PRIVATE_TO_JSVAL(this));
js::SetFunctionNativeReserved(funobj, XPC_FUNCTION_NATIVE_MEMBER_SLOT,
PrivateValue(this));
*vp = OBJECT_TO_JSVAL(funobj);

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

@ -1250,6 +1250,10 @@ private:
bool mUseContentXBLScope;
};
/***************************************************************************/
// Slots we use for our functions
#define XPC_FUNCTION_NATIVE_MEMBER_SLOT 0
/***************************************************************************/
// XPCNativeMember represents a single idl declared method, attribute or
// constant.