зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1135785 - Introduce a 1-argument overload of ProxyMediaCall. r=cpearce
This commit is contained in:
Родитель
a0678bc6cb
Коммит
206603a7ab
|
@ -591,7 +591,19 @@ protected:
|
|||
Type mMethod;
|
||||
};
|
||||
|
||||
// NB: MethodCallWithOneArg definition should go here, if/when it is needed.
|
||||
template<typename PromiseType, typename ThisType, typename Arg1Type>
|
||||
class MethodCallWithOneArg : public MethodCallBase<PromiseType>
|
||||
{
|
||||
public:
|
||||
typedef nsRefPtr<PromiseType>(ThisType::*Type)(Arg1Type);
|
||||
MethodCallWithOneArg(ThisType* aThisVal, Type aMethod, Arg1Type aArg1)
|
||||
: mThisVal(aThisVal), mMethod(aMethod), mArg1(aArg1) {}
|
||||
nsRefPtr<PromiseType> Invoke() MOZ_OVERRIDE { return ((*mThisVal).*mMethod)(mArg1); }
|
||||
protected:
|
||||
nsRefPtr<ThisType> mThisVal;
|
||||
Type mMethod;
|
||||
Arg1Type mArg1;
|
||||
};
|
||||
|
||||
template<typename PromiseType, typename ThisType, typename Arg1Type, typename Arg2Type>
|
||||
class MethodCallWithTwoArgs : public MethodCallBase<PromiseType>
|
||||
|
@ -652,7 +664,15 @@ ProxyMediaCall(TargetType* aTarget, ThisType* aThisVal, const char* aCallerName,
|
|||
return detail::ProxyInternal(aTarget, methodCall, aCallerName);
|
||||
}
|
||||
|
||||
// NB: One-arg overload should go here, if/when it is needed.
|
||||
template<typename PromiseType, typename TargetType, typename ThisType, typename Arg1Type>
|
||||
static nsRefPtr<PromiseType>
|
||||
ProxyMediaCall(TargetType* aTarget, ThisType* aThisVal, const char* aCallerName,
|
||||
nsRefPtr<PromiseType>(ThisType::*aMethod)(Arg1Type), Arg1Type aArg1)
|
||||
{
|
||||
typedef detail::MethodCallWithOneArg<PromiseType, ThisType, Arg1Type> MethodCallType;
|
||||
MethodCallType* methodCall = new MethodCallType(aThisVal, aMethod, aArg1);
|
||||
return detail::ProxyInternal(aTarget, methodCall, aCallerName);
|
||||
}
|
||||
|
||||
template<typename PromiseType, typename TargetType, typename ThisType,
|
||||
typename Arg1Type, typename Arg2Type>
|
||||
|
|
Загрузка…
Ссылка в новой задаче