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).

R=robliao@chromium.org

Bug: 708584, 783309
Change-Id: Id6acb3176d23b8161b686f715c710646c27acfe5
Reviewed-on: https://chromium-review.googlesource.com/866836
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#529753}
2 files changed