зеркало из https://github.com/mozilla/gecko-dev.git
Bug 683802 - Use an explicit indicator for direct vs indirect calling semantics. r=mrbkap
This commit is contained in:
Родитель
3f14d546aa
Коммит
f8a8e56c45
|
@ -932,7 +932,7 @@ nsXPCWrappedJSClass::GetArraySizeFromParam(JSContext* cx,
|
|||
if(arg_type.IsPointer() || arg_type.TagPart() != nsXPTType::T_U32)
|
||||
return JS_FALSE;
|
||||
|
||||
if(arg_param.IsOut())
|
||||
if(arg_param.IsIndirect())
|
||||
*result = *(JSUint32*)nativeParams[argnum].val.p;
|
||||
else
|
||||
*result = nativeParams[argnum].val.u32;
|
||||
|
@ -973,7 +973,7 @@ nsXPCWrappedJSClass::GetInterfaceTypeFromParam(JSContext* cx,
|
|||
if(arg_type.IsPointer() &&
|
||||
arg_type.TagPart() == nsXPTType::T_IID)
|
||||
{
|
||||
if(arg_param.IsOut())
|
||||
if(arg_param.IsIndirect())
|
||||
{
|
||||
nsID** p = (nsID**) nativeParams[argnum].val.p;
|
||||
if(!p || !*p)
|
||||
|
@ -1509,8 +1509,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex,
|
|||
{
|
||||
nsXPTCMiniVariant* pv;
|
||||
|
||||
// Temporary hack - we'll abstract this away soon.
|
||||
if(param.IsOut() || type.TagPart() == nsXPTType::T_JSVAL)
|
||||
if(param.IsIndirect())
|
||||
pv = (nsXPTCMiniVariant*) nativeParams[i].val.p;
|
||||
else
|
||||
pv = &nativeParams[i];
|
||||
|
|
|
@ -2830,6 +2830,10 @@ CallMethodHelper::ConvertIndependentParam(uint8 i)
|
|||
if(paramInfo.IsDipper())
|
||||
return HandleDipperParam(dp, paramInfo);
|
||||
|
||||
// Specify the correct storage/calling semantics.
|
||||
if(paramInfo.IsIndirect())
|
||||
dp->SetIndirect();
|
||||
|
||||
if(type_tag == nsXPTType::T_INTERFACE)
|
||||
{
|
||||
dp->SetValIsInterface();
|
||||
|
@ -2844,9 +2848,6 @@ CallMethodHelper::ConvertIndependentParam(uint8 i)
|
|||
// indirectly, regardless of in/out-ness.
|
||||
if(type_tag == nsXPTType::T_JSVAL)
|
||||
{
|
||||
// Indicate the storage semantics.
|
||||
dp->SetIndirect();
|
||||
|
||||
// Assign the value
|
||||
JS_STATIC_ASSERT(sizeof(jsval) <= sizeof(dp->val));
|
||||
jsval *rootp = (jsval *)&dp->val;
|
||||
|
@ -2859,8 +2860,6 @@ CallMethodHelper::ConvertIndependentParam(uint8 i)
|
|||
|
||||
if(paramInfo.IsOut())
|
||||
{
|
||||
dp->SetIndirect();
|
||||
|
||||
if(type.IsPointer() &&
|
||||
type_tag != nsXPTType::T_INTERFACE &&
|
||||
!paramInfo.IsShared())
|
||||
|
@ -2966,6 +2965,10 @@ CallMethodHelper::ConvertDependentParams()
|
|||
nsXPTCVariant* dp = GetDispatchParam(i);
|
||||
dp->type = type;
|
||||
|
||||
// Specify the correct storage/calling semantics.
|
||||
if(paramInfo.IsIndirect())
|
||||
dp->SetIndirect();
|
||||
|
||||
if(isArray)
|
||||
{
|
||||
dp->SetValIsArray();
|
||||
|
@ -2992,8 +2995,6 @@ CallMethodHelper::ConvertDependentParams()
|
|||
|
||||
if(paramInfo.IsOut())
|
||||
{
|
||||
dp->SetIndirect();
|
||||
|
||||
if(datum_type.IsPointer() &&
|
||||
!datum_type.IsInterfacePointer() &&
|
||||
(isArray || !paramInfo.IsShared()))
|
||||
|
|
|
@ -160,6 +160,12 @@ public:
|
|||
PRBool IsOptional() const {return 0 != (XPT_PD_IS_OPTIONAL(flags));}
|
||||
const nsXPTType GetType() const {return type.prefix;}
|
||||
|
||||
// Whether this parameter is passed indirectly on the stack. This mainly
|
||||
// applies to out/inout params, but we use it unconditionally for certain
|
||||
// types.
|
||||
PRBool IsIndirect() const {return IsOut() ||
|
||||
GetType().TagPart() == nsXPTType::T_JSVAL;}
|
||||
|
||||
// NOTE: other activities on types are done via methods on nsIInterfaceInfo
|
||||
|
||||
private:
|
||||
|
|
Загрузка…
Ссылка в новой задаче