bug 1358898, ensure AsyncFreeSnowWhite is run often enough, r=mccr8,nfroyd

This commit is contained in:
Olli Pettay 2017-06-16 20:00:04 +03:00
Родитель fa242ea02c
Коммит 2edc8a2488
2 изменённых файлов: 7 добавлений и 8 удалений

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

@ -139,12 +139,8 @@ public:
nsresult Dispatch()
{
nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
if (!thread) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIRunnable> self(this);
return thread->IdleDispatch(self.forget());
return NS_IdleDispatchToCurrentThread(self.forget(), 1000);
}
void Start(bool aContinuation = false, bool aPurge = false)

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

@ -370,6 +370,11 @@ NS_IdleDispatchToCurrentThread(already_AddRefed<nsIRunnable>&& aEvent,
{
nsCOMPtr<nsIRunnable> event(Move(aEvent));
NS_ENSURE_TRUE(event, NS_ERROR_INVALID_ARG);
//XXX Using current thread for now as the nsIEventTarget.
nsIEventTarget* target = mozilla::GetCurrentThreadEventTarget();
NS_ENSURE_STATE(target);
nsCOMPtr<nsIIdleRunnable> idleEvent = do_QueryInterface(event);
if (!idleEvent) {
@ -377,9 +382,7 @@ NS_IdleDispatchToCurrentThread(already_AddRefed<nsIRunnable>&& aEvent,
event = do_QueryInterface(idleEvent);
MOZ_DIAGNOSTIC_ASSERT(event);
}
//XXX Using current thread for now as the nsIEventTarget.
idleEvent->SetTimer(aTimeout, NS_GetCurrentThread());
idleEvent->SetTimer(aTimeout, target);
return NS_IdleDispatchToCurrentThread(event.forget());
}