Bug 1268160: Assert that PostIdleTask is only used on the main thread. r=jld

This commit is contained in:
Kyle Huey 2016-05-12 15:15:43 -07:00
Родитель 6277b426b1
Коммит d3cc4b02b6
3 изменённых файлов: 7 добавлений и 4 удалений

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

@ -271,6 +271,7 @@ void MessageLoop::PostDelayedTask(already_AddRefed<Runnable> task, int delay_ms)
void MessageLoop::PostIdleTask(already_AddRefed<Runnable> task) {
DCHECK(current() == this);
MOZ_ASSERT(NS_IsMainThread());
PendingTask pending_task(Move(task), false);
deferred_non_nestable_work_queue_.push(Move(pending_task));

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

@ -356,7 +356,8 @@ MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate* aDelegate)
continue;
}
didWork = aDelegate->DoIdleWork();
DebugOnly<bool> didIdleWork = aDelegate->DoIdleWork();
MOZ_ASSERT(!didIdleWork);
if (!keep_running_) {
break;
}
@ -418,7 +419,8 @@ MessagePumpForNonMainUIThreads::DoRunLoop()
continue;
}
didWork = state_->delegate->DoIdleWork();
DebugOnly<bool> didIdleWork = state_->delegate->DoIdleWork();
MOZ_ASSERT(!didIdleWork);
CHECK_QUIT_STATE
SetInWait();

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

@ -13,8 +13,8 @@ interface nsIRunnable;
* or may not make sense for you to use this interface. If you're calling from
* JS, you don't have a choice!
*
* Right now, you can only call PostIdleTask(), but nothing is stopping you
* from adding other methods.
* Right now, you can only call PostIdleTask(), and the wrath of khuey is
* stopping you from adding other methods.
*
* nsIMessageLoop's contractid is "@mozilla.org/message-loop;1".
*/