[MessageLoop] Clear all pending tasks in TriageQueue::Clear

This is a precursor to moving the |incoming_queue_| multi-threaded part
of IncomingTaskQueue to MessageLoopTaskRunner to allow mocking the
source of incoming tasks (i.e. for ScopedTaskEnvironment::MOCK_TIME on
top of MLForUI/etc.).

Such an interface will not have a notion of pre-triaged versus
still-on-multi-threaded-queue tasks. What matters here is that
TriageQueue::Clear() doesn't get stuck in a loop, the new logic clears
all pending tasks while still backing out if destructors post more

R=danakj@chromium.org, kylechar@chromium.org

Bug: 708584
Change-Id: I8cd4f244718e4f5f74d5cb84138083ee37833238
Reviewed-on: https://chromium-review.googlesource.com/1078932
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563846}
3 files changed