sequence_manager: Don't stop processing tasks after RunLoop::Quit()

This patch makes ThreadControllerWithMessagePumpImpl continue processing
tasks even after the enclosing RunLoop has been quit. This is needed for
MessageLoop compatibility in the following scenario:

1. A RunLoop is entered.
2. A native OS-level runloop is started, e.g., by opening a popup menu
   on Mac. Chrome tasks are allowed to executing in this nested loop.
3. A task is posted terminate the nested loop.
4. Before the above task has a chance to execute, a native callback
   calls RunLoop::Quit().

Because from Chrome's point of view there is no runloop nesting
happening in the above scenario, RunLoop decides that it is the
innermost one and tells ThreadControllerWithMessagePumpImpl to quit.
However this doesn't terminate the OS-level loop and we get a live-lock.

As Quit() is only supposed to affect RunLoop behavior instead of
preventing tasks from getting executed, this patch changes
ThreadControllerWithMessagePumpImpl to match the behavior of
MessageLoop, i.e., allowing tasks to run after Quit().

Bug: 891670
Change-Id: I64fd335c122a0a6709f0c7222cfa1d3140a702e6
Reviewed-on: https://chromium-review.googlesource.com/c/1367660
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616043}
3 files changed