зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
8b24c9d51c
Коммит
65715152b1
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче