Bug 1281626 - part 4 - change NS_NewRunnableFunction to return already_AddRefed; r=khuey

This change makes it more consistent with NS_NewRunnableMethod and also
opens up optimization opportunities for later.
This commit is contained in:
Nathan Froyd 2016-06-28 22:24:54 -04:00
Родитель 8b24c9d51c
Коммит 65715152b1
1 изменённых файлов: 6 добавлений и 6 удалений

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

@ -283,14 +283,14 @@ private:
};
template<typename Function>
nsRunnableFunction<typename mozilla::RemoveReference<Function>::Type>*
already_AddRefed<nsRunnableFunction<typename mozilla::RemoveReference<Function>::Type>>
NS_NewRunnableFunction(Function&& aFunction)
{
return new nsRunnableFunction
// Make sure we store a non-reference in nsRunnableFunction.
<typename mozilla::RemoveReference<Function>::Type>
// But still forward aFunction to move if possible.
(mozilla::Forward<Function>(aFunction));
return do_AddRef(new nsRunnableFunction
// Make sure we store a non-reference in nsRunnableFunction.
<typename mozilla::RemoveReference<Function>::Type>
// But still forward aFunction to move if possible.
(mozilla::Forward<Function>(aFunction)));
}
// An event that can be used to call a method on a class. The class type must