зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1348900 - Remove NewTimerCallback as it has been replaced by NewNamedTimerCallback. r=kats
MozReview-Commit-ID: 9Ap24GZ8M4 --HG-- extra : rebase_source : 5c42ee2240f297ed6865bce6922ad55b444b5ef4
This commit is contained in:
Родитель
abbed5a7c1
Коммит
48061f481f
|
@ -73,7 +73,6 @@ APZThreadUtils::IsControllerThread()
|
|||
return sControllerThread == MessageLoop::current();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(GenericTimerCallbackBase, nsITimerCallback)
|
||||
NS_IMPL_ISUPPORTS(GenericNamedTimerCallbackBase, nsITimerCallback, nsINamed)
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -59,46 +59,6 @@ public:
|
|||
static bool IsControllerThread();
|
||||
};
|
||||
|
||||
// A base class for GenericTimerCallback<Function>.
|
||||
// This is necessary because NS_IMPL_ISUPPORTS doesn't work for a class
|
||||
// template.
|
||||
class GenericTimerCallbackBase : public nsITimerCallback
|
||||
{
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
protected:
|
||||
virtual ~GenericTimerCallbackBase() {}
|
||||
};
|
||||
|
||||
// An nsITimerCallback implementation that can be used with any function
|
||||
// object that's callable with no arguments.
|
||||
template <typename Function>
|
||||
class GenericTimerCallback final : public GenericTimerCallbackBase
|
||||
{
|
||||
public:
|
||||
explicit GenericTimerCallback(const Function& aFunction) : mFunction(aFunction) {}
|
||||
|
||||
NS_IMETHOD Notify(nsITimer*) override
|
||||
{
|
||||
mFunction();
|
||||
return NS_OK;
|
||||
}
|
||||
private:
|
||||
Function mFunction;
|
||||
};
|
||||
|
||||
// Convenience function for constructing a GenericTimerCallback.
|
||||
// Returns a raw pointer, suitable for passing directly as an argument to
|
||||
// nsITimer::InitWithCallback(). The intention is to enable the following
|
||||
// terse inline usage:
|
||||
// timer->InitWithCallback(NewTimerCallback([](){ ... }), delay);
|
||||
template <typename Function>
|
||||
GenericTimerCallback<Function>* NewTimerCallback(const Function& aFunction)
|
||||
{
|
||||
return new GenericTimerCallback<Function>(aFunction);
|
||||
}
|
||||
|
||||
// A base class for GenericNamedTimerCallback<Function>.
|
||||
// This is necessary because NS_IMPL_ISUPPORTS doesn't work for a class
|
||||
// template.
|
||||
|
|
Загрузка…
Ссылка в новой задаче