Worker: Make sure to post messages after dedicated worker script evaluation

This is a preparation CL for module scripts on workers.

Before this CL, postMessage() requests during dedicated worker startup are
queued until a worker thread is created and a thread initialization task is
posted to the worker thread. This works for classic scripts because classic
script evaluation happens synchronously after thread initialization and there is
no timing to interleave the message tasks. However, this is not applicable for
module scripts because module script evaluation happens asynchronously on the
worker thread. This allows posted tasks run before script evaluation and results
in dropouts of the Message events.

This CL makes sure to post message tasks after script evaluation. ObjectProxy on
the worker thread notifies MessagingProxy on the main thread of the completion
of script evaluation, and then MessagingProxy posts queued messages.

Bug: 680046
Change-Id: I7cb32cc8911a7bbe9e5d83e5f7fceb333bb3125a
Reviewed-on: https://chromium-review.googlesource.com/967914
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Makoto Shimazu <shimazu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543996}
4 files changed