Cleanup WorkerThreadableWebSocketChannel's logic to wait for the main thread

- Pass WorkerGlobalScope as a reference until we set it to RefPtr
- Wrap m_syncHelper with a function hasTerminatedPeer() for readability
- Stop holding reference on WorkerGlobalScope in
  WorkerThreadableWebSocketChannel
- Move ASSERT(m_syncHelper) to waitForMethodCompletion()
- Return a value indicating failure when waitForMethodCompletion()
  returns because of shutdown
- Make the methods not calling waitForMethodCompletion() also return
  without doing anything if the peer is already terminated
- Move task posting code into waitForMethodCompletion()
- More comments for readability

BUG=none

Review URL: https://codereview.chromium.org/265713004

git-svn-id: svn://svn.chromium.org/blink/trunk@173608 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Web Animations: Fix error in clock update logic and re-enable timeline-time test

BUG=367903

Review URL: https://codereview.chromium.org/279493003

git-svn-id: svn://svn.chromium.org/blink/trunk@173609 bbb929c8-8fbe-4397-9dbb-9b2b20218538