ServiceWorker: Send state change events via SWProviderHost
This CL refactors relationship among SW(Registration)Handle, SWProviderHost and
SWDispatcherHost.
Before this CL, the handle directly asks SWDispatcherHost to send an IPC
message when it receives an state change notification. After this CL, the
handle retains a weakptr to SWProviderHost and asks it to send the message.
This change enables that...
- the handles don't have to take care of receiver's thread id anymore.
It's managed by SWProviderHost instead. (Currently the thread id is hard-coded
as kDocumentMainThreadId, but I'll make it injectable in a subsequent CL.)
- IPC messages could be queued up when the receiver's thread hasn't been ready
to receive the messages. This would be useful when we support the worker thread
as a receiver's thread.
BUG=437677
TEST=content_unittests --gtest_filter=ServiceWorker*
TEST=run-webkit-tests http/tests/serviceworker/
Review URL: https://codereview.chromium.org/
825383004
Cr-Commit-Position: refs/heads/master@{#312592}