Commit 094fbcd1 authored by Greg Kraynov's avatar Greg Kraynov Committed by Commit Bot

Explain why ThreadControllerImpl disables batching optimization.

When we're in a nested RunLoop we can't run tasks in a batch.
This comment update explains why.

Bug: 828835
Change-Id: I8dcdf7f06d519f0e8087232b2d3c660e26510b60
Reviewed-on: https://chromium-review.googlesource.com/1124694Reviewed-by: default avatarAlex Clarke <alexclarke@chromium.org>
Commit-Queue: Greg Kraynov <kraynov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572526}
parent 77d4a1e4
......@@ -170,7 +170,16 @@ void ThreadControllerImpl::DoWork(WorkType work_type) {
sequence_->DidRunTask();
// TODO(alexclarke): Find out why this is needed.
// NOTE: https://crbug.com/828835.
// When we're running inside a nested RunLoop it may quit anytime, so any
// outstanding pending tasks must run in the outer RunLoop
// (see SequenceManagerTestWithMessageLoop.QuitWhileNested test).
// Unfortunately, it's MessageLoop who's receving that signal and we can't
// know it before we return from DoWork, hence, OnExitNestedRunLoop
// will be called later. Since we must implement ThreadController and
// SequenceManager in conformance with MessageLoop task runners, we need
// to disable this batching optimization while nested.
// Implementing RunLoop::Delegate ourselves will help to resolve this issue.
if (main_sequence_only().nesting_depth > 0)
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment