Prepare WorkerThreadableLoader for nested workers

The logic of WorkerThreadableLoader actually supports nested workers
as-is (i.e., it will proxy a nested worker's sync request and run it
as an async request on the parent worker's thread), but it does a lot
of DCHECKs based on IsMainThread(), which will fail because a nested
worker's parent isn't on the main thread.

* Initial cleanup step: AsyncTaskForwarder is dead code. Remove it
  and flatten SyncTaskForward into TaskForwarder.
* Rename anything that mentions the main thread to refer to
  the parent thread instead.
* Make DocumentThreadableLoader::GetExecutionContext() public, and
  use its IsContextThread() for DCHECKs in ParentThreadLoaderHolder
* Use WorkerThreadableLoader::worker_global_scope_ for DCHECKS in
  WorkerThreadableLoader itself.
* Plumb a worker task runner to TaskForwarder and
  WaitableEventWithTasks (#if DCHECK_IS_ON()) for their thread safety
  checks.

Bug: 829119
Change-Id: Ied542e99f2566462f290ae5e0a0d1da57e63730f
Reviewed-on: https://chromium-review.googlesource.com/1064796
Commit-Queue: Nate Chapin <japhet@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559991}
3 files changed