Backed out 2 changesets (bug 1329319) because it will not build a=backout

Backed out changeset ae96a44e6a8f (bug 1329319)
Backed out changeset a75ecabf7129 (bug 1329319)

MozReview-Commit-ID: HQ3on7jlZXN
This commit is contained in:
Wes Kocher 2017-01-09 15:46:42 -08:00
Родитель 53855b51b8
Коммит b0df943433
3 изменённых файлов: 52 добавлений и 113 удалений

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

@ -960,7 +960,7 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
// 1. Update the duration attribute if it currently equals NaN.
// Those steps are performed by the MediaSourceDecoder::SetInitialDuration
AbstractThread::MainThread()->Dispatch(NewRunnableMethod<int64_t>
(mParentDecoder.get(),
(mParentDecoder,
&MediaSourceDecoder::SetInitialDuration,
duration ? duration : -1));

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

@ -463,70 +463,57 @@ struct nsRunnableMethodReceiver<ClassType, false>
void Revoke() { mObj = nullptr; }
};
template<typename PtrType, typename Method, bool Owning, bool Cancelable>
struct nsRunnableMethodTraits;
template<typename Method, bool Owning, bool Cancelable> struct nsRunnableMethodTraits;
template<typename PtrType, class C, typename R, bool Owning, bool Cancelable, typename... As>
struct nsRunnableMethodTraits<PtrType, R(C::*)(As...), Owning, Cancelable>
template<class C, typename R, bool Owning, bool Cancelable, typename... As>
struct nsRunnableMethodTraits<R(C::*)(As...), Owning, Cancelable>
{
typedef typename mozilla::RemoveAnyPointer<PtrType>::Type class_type;
static_assert(mozilla::IsBaseOf<C, class_type>::value,
"Stored class must inherit from method's class");
typedef C class_type;
typedef R return_type;
typedef nsRunnableMethod<C, R, Owning, Cancelable> base_type;
static const bool can_cancel = Cancelable;
};
template<typename PtrType, class C, typename R, bool Owning, bool Cancelable, typename... As>
struct nsRunnableMethodTraits<PtrType, R(C::*)(As...) const, Owning, Cancelable>
template<class C, typename R, bool Owning, bool Cancelable, typename... As>
struct nsRunnableMethodTraits<R(C::*)(As...) const, Owning, Cancelable>
{
typedef const typename mozilla::RemoveAnyPointer<PtrType>::Type class_type;
static_assert(mozilla::IsBaseOf<C, class_type>::value,
"Stored class must inherit from method's class");
typedef const C class_type;
typedef R return_type;
typedef nsRunnableMethod<C, R, Owning, Cancelable> base_type;
static const bool can_cancel = Cancelable;
};
#ifdef NS_HAVE_STDCALL
template<typename PtrType, class C, typename R, bool Owning, bool Cancelable, typename... As>
struct nsRunnableMethodTraits<PtrType, R(__stdcall C::*)(As...), Owning, Cancelable>
template<class C, typename R, bool Owning, bool Cancelable, typename... As>
struct nsRunnableMethodTraits<R(__stdcall C::*)(As...), Owning, Cancelable>
{
typedef typename mozilla::RemoveAnyPointer<PtrType>::Type class_type;
static_assert(mozilla::IsBaseOf<C, class_type>::value,
"Stored class must inherit from method's class");
typedef C class_type;
typedef R return_type;
typedef nsRunnableMethod<C, R, Owning, Cancelable> base_type;
static const bool can_cancel = Cancelable;
};
template<typename PtrType, class C, typename R, bool Owning, bool Cancelable>
struct nsRunnableMethodTraits<PtrType, R(NS_STDCALL C::*)(), Owning, Cancelable>
template<class C, typename R, bool Owning, bool Cancelable>
struct nsRunnableMethodTraits<R(NS_STDCALL C::*)(), Owning, Cancelable>
{
typedef typename mozilla::RemoveAnyPointer<PtrType>::Type class_type;
static_assert(mozilla::IsBaseOf<C, class_type>::value,
"Stored class must inherit from method's class");
typedef C class_type;
typedef R return_type;
typedef nsRunnableMethod<C, R, Owning, Cancelable> base_type;
static const bool can_cancel = Cancelable;
};
template<typename PtrType, class C, typename R, bool Owning, bool Cancelable, typename... As>
struct nsRunnableMethodTraits<PtrType, R(__stdcall C::*)(As...) const, Owning, Cancelable>
template<class C, typename R, bool Owning, bool Cancelable, typename... As>
struct nsRunnableMethodTraits<R(__stdcall C::*)(As...) const, Owning, Cancelable>
{
typedef const typename mozilla::RemoveAnyPointer<PtrType>::Type class_type;
static_assert(mozilla::IsBaseOf<C, class_type>::value,
"Stored class must inherit from method's class");
typedef const C class_type;
typedef R return_type;
typedef nsRunnableMethod<C, R, Owning, Cancelable> base_type;
static const bool can_cancel = Cancelable;
};
template<typename PtrType, class C, typename R, bool Owning, bool Cancelable>
struct nsRunnableMethodTraits<PtrType, R(NS_STDCALL C::*)() const, Owning, Cancelable>
template<class C, typename R, bool Owning, bool Cancelable>
struct nsRunnableMethodTraits<R(NS_STDCALL C::*)() const, Owning, Cancelable>
{
typedef const typename mozilla::RemoveAnyPointer<PtrType>::Type class_type;
static_assert(mozilla::IsBaseOf<C, class_type>::value,
"Stored class must inherit from method's class");
typedef const C class_type;
typedef R return_type;
typedef nsRunnableMethod<C, R, Owning, Cancelable> base_type;
static const bool can_cancel = Cancelable;
@ -833,11 +820,11 @@ struct RunnableMethodArguments final
}
};
template<typename PtrType, typename Method, bool Owning, bool Cancelable, typename... Storages>
template<typename Method, bool Owning, bool Cancelable, typename... Storages>
class RunnableMethodImpl final
: public ::nsRunnableMethodTraits<PtrType, Method, Owning, Cancelable>::base_type
: public ::nsRunnableMethodTraits<Method, Owning, Cancelable>::base_type
{
typedef typename ::nsRunnableMethodTraits<PtrType, Method, Owning, Cancelable>::class_type
typedef typename ::nsRunnableMethodTraits<Method, Owning, Cancelable>::class_type
ClassType;
::nsRunnableMethodReceiver<ClassType, Owning> mReceiver;
Method mMethod;
@ -845,10 +832,10 @@ class RunnableMethodImpl final
private:
virtual ~RunnableMethodImpl() { Revoke(); };
public:
template<typename ForwardedPtrType, typename... Args>
explicit RunnableMethodImpl(ForwardedPtrType&& aObj, Method aMethod,
template<typename... Args>
explicit RunnableMethodImpl(ClassType* aObj, Method aMethod,
Args&&... aArgs)
: mReceiver(Forward<ForwardedPtrType>(aObj))
: mReceiver(aObj)
, mMethod(aMethod)
, mArgs(Forward<Args>(aArgs)...)
{
@ -883,112 +870,76 @@ public:
//
template<typename PtrType, typename Method>
already_AddRefed<
typename ::nsRunnableMethodTraits<
typename RemoveReference<PtrType>::Type, Method, true, false>::base_type>
NewRunnableMethod(PtrType&& aPtr, Method aMethod)
already_AddRefed<typename ::nsRunnableMethodTraits<Method, true, false>::base_type>
NewRunnableMethod(PtrType aPtr, Method aMethod)
{
return do_AddRef(
new detail::RunnableMethodImpl
<typename RemoveReference<PtrType>::Type, Method, true, false>
(Forward<PtrType>(aPtr), aMethod));
return do_AddRef(new detail::RunnableMethodImpl<Method, true, false>(aPtr, aMethod));
}
template<typename PtrType, typename Method>
already_AddRefed<
typename ::nsRunnableMethodTraits<
typename RemoveReference<PtrType>::Type, Method, true, true>::base_type>
NewCancelableRunnableMethod(PtrType&& aPtr, Method aMethod)
already_AddRefed<typename ::nsRunnableMethodTraits<Method, true, true>::base_type>
NewCancelableRunnableMethod(PtrType aPtr, Method aMethod)
{
return do_AddRef(
new detail::RunnableMethodImpl
<typename RemoveReference<PtrType>::Type, Method, true, true>
(Forward<PtrType>(aPtr), aMethod));
return do_AddRef(new detail::RunnableMethodImpl<Method, true, true>(aPtr, aMethod));
}
template<typename PtrType, typename Method>
already_AddRefed<
typename ::nsRunnableMethodTraits<
typename RemoveReference<PtrType>::Type, Method, false, false>::base_type>
already_AddRefed<typename ::nsRunnableMethodTraits<Method, false, false>::base_type>
NewNonOwningRunnableMethod(PtrType&& aPtr, Method aMethod)
{
return do_AddRef(
new detail::RunnableMethodImpl
<typename RemoveReference<PtrType>::Type, Method, false, false>
(Forward<PtrType>(aPtr), aMethod));
return do_AddRef(new detail::RunnableMethodImpl<Method, false, false>(aPtr, aMethod));
}
template<typename PtrType, typename Method>
already_AddRefed<
typename ::nsRunnableMethodTraits<
typename RemoveReference<PtrType>::Type, Method, false, true>::base_type>
already_AddRefed<typename ::nsRunnableMethodTraits<Method, false, true>::base_type>
NewNonOwningCancelableRunnableMethod(PtrType&& aPtr, Method aMethod)
{
return do_AddRef(
new detail::RunnableMethodImpl
<typename RemoveReference<PtrType>::Type, Method, false, true>
(Forward<PtrType>(aPtr), aMethod));
return do_AddRef(new detail::RunnableMethodImpl<Method, false, true>(aPtr, aMethod));
}
// Similar to NewRunnableMethod. Call like so:
// nsCOMPtr<nsIRunnable> event =
// NewRunnableMethod<Types,...>(myObject, &MyClass::HandleEvent, myArg1,...);
// 'Types' are the stored type for each argument, see ParameterStorage for details.
template<typename... Storages, typename PtrType, typename Method, typename... Args>
already_AddRefed<
typename ::nsRunnableMethodTraits<
typename RemoveReference<PtrType>::Type, Method, true, false>::base_type>
template<typename... Storages, typename Method, typename PtrType, typename... Args>
already_AddRefed<typename ::nsRunnableMethodTraits<Method, true, false>::base_type>
NewRunnableMethod(PtrType&& aPtr, Method aMethod, Args&&... aArgs)
{
static_assert(sizeof...(Storages) == sizeof...(Args),
"<Storages...> size should be equal to number of arguments");
return do_AddRef(
new detail::RunnableMethodImpl
<typename RemoveReference<PtrType>::Type, Method, true, false, Storages...>
(Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
return do_AddRef(new detail::RunnableMethodImpl<Method, true, false, Storages...>(
aPtr, aMethod, mozilla::Forward<Args>(aArgs)...));
}
template<typename... Storages, typename PtrType, typename Method, typename... Args>
already_AddRefed<
typename ::nsRunnableMethodTraits<
typename RemoveReference<PtrType>::Type, Method, false, false>::base_type>
template<typename... Storages, typename Method, typename PtrType, typename... Args>
already_AddRefed<typename ::nsRunnableMethodTraits<Method, false, false>::base_type>
NewNonOwningRunnableMethod(PtrType&& aPtr, Method aMethod, Args&&... aArgs)
{
static_assert(sizeof...(Storages) == sizeof...(Args),
"<Storages...> size should be equal to number of arguments");
return do_AddRef(
new detail::RunnableMethodImpl
<typename RemoveReference<PtrType>::Type, Method, false, false, Storages...>
(Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
return do_AddRef(new detail::RunnableMethodImpl<Method, false, false, Storages...>(
aPtr, aMethod, mozilla::Forward<Args>(aArgs)...));
}
template<typename... Storages, typename PtrType, typename Method, typename... Args>
already_AddRefed<
typename ::nsRunnableMethodTraits<
typename RemoveReference<PtrType>::Type, Method, true, true>::base_type>
template<typename... Storages, typename Method, typename PtrType, typename... Args>
already_AddRefed<typename ::nsRunnableMethodTraits<Method, true, true>::base_type>
NewCancelableRunnableMethod(PtrType&& aPtr, Method aMethod, Args&&... aArgs)
{
static_assert(sizeof...(Storages) == sizeof...(Args),
"<Storages...> size should be equal to number of arguments");
return do_AddRef(
new detail::RunnableMethodImpl
<typename RemoveReference<PtrType>::Type, Method, true, true, Storages...>
(Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
return do_AddRef(new detail::RunnableMethodImpl<Method, true, true, Storages...>(
aPtr, aMethod, mozilla::Forward<Args>(aArgs)...));
}
template<typename... Storages, typename PtrType, typename Method, typename... Args>
already_AddRefed<
typename ::nsRunnableMethodTraits<
typename RemoveReference<PtrType>::Type, Method, false, true>::base_type>
template<typename... Storages, typename Method, typename PtrType, typename... Args>
already_AddRefed<typename ::nsRunnableMethodTraits<Method, false, true>::base_type>
NewNonOwningCancelableRunnableMethod(PtrType&& aPtr, Method aMethod,
Args&&... aArgs)
{
static_assert(sizeof...(Storages) == sizeof...(Args),
"<Storages...> size should be equal to number of arguments");
return do_AddRef(
new detail::RunnableMethodImpl
<typename RemoveReference<PtrType>::Type, Method, false, true, Storages...>
(Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
return do_AddRef(new detail::RunnableMethodImpl<Method, false, true, Storages...>(
aPtr, aMethod, mozilla::Forward<Args>(aArgs)...));
}
} // namespace mozilla

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

@ -180,13 +180,7 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(IThreadUtilsObject, NS_IFOO_IID)
struct ThreadUtilsObjectNonRefCountedBase
{
virtual void MethodFromNonRefCountedBase() {}
};
struct ThreadUtilsObject : public IThreadUtilsObject
, public ThreadUtilsObjectNonRefCountedBase
{
// nsISupports implementation
NS_DECL_ISUPPORTS
@ -380,12 +374,6 @@ TEST(ThreadUtils, main)
EXPECT_EQ(count += 2, rpt->mCount);
EXPECT_EQ(11, rpt->mA0);
// Test calling a method from a non-ref-counted base.
r1 = NewRunnableMethod(rpt, &ThreadUtilsObject::MethodFromNonRefCountedBase);
r1->Run();
EXPECT_EQ(count, rpt->mCount);
// Test variadic function with simple POD arguments.
r1 = NewRunnableMethod(rpt, &ThreadUtilsObject::Test0);