Mark IncomingTaskQueue::message_loop_scheduled_ after kicking it off.

Also grab the lock although it shouldn't yet be contended for good
measure and to be future proof.

I realized it also served the purpose of serializing ScheduleWork() calls
when trying to figure out how to implement ThreadController::ScheduleWork()
(ref. Blink/TaskScheduler merge and ScopedTaskEnvironment MOCK_TIME over
non-default MessageLoops). MessageLoop::ScheduleWork() itself is
documented as requiring mutually exclusive calls (and some
MessagePump::ScheduleWork() impls indeed require this per touching
non atomic state).

Bug: 708584, 783309
Change-Id: Id6acb3176d23b8161b686f715c710646c27acfe5
Commit-Queue: Gabriel Charette <>
Reviewed-by: Robert Liao <>
Cr-Commit-Position: refs/heads/master@{#529753}
2 files changed