ServiceWorker: Send state change events via SWProviderHost
commit084b4564fc3f39352e9c394fd803a9fb248e2efb
authornhiroki <nhiroki@chromium.org>
Thu, 22 Jan 2015 08:59:32 +0000 (22 00:59 -0800)
committerCommit bot <commit-bot@chromium.org>
Thu, 22 Jan 2015 09:01:19 +0000 (22 09:01 +0000)
tree08e561173ac0a335efe0e61901c8ee227148ee01
parent3109a22e2bb8625ef74b019737572bd51614c932
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}
content/browser/service_worker/service_worker_dispatcher_host.cc
content/browser/service_worker/service_worker_dispatcher_host.h
content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
content/browser/service_worker/service_worker_handle.cc
content/browser/service_worker/service_worker_handle.h
content/browser/service_worker/service_worker_handle_unittest.cc
content/browser/service_worker/service_worker_provider_host.cc
content/browser/service_worker/service_worker_provider_host.h
content/browser/service_worker/service_worker_registration_handle.cc
content/browser/service_worker/service_worker_registration_handle.h
content/browser/service_worker/service_worker_registration_unittest.cc