| Index: content/browser/service_worker/service_worker_provider_host.cc
|
| diff --git a/content/browser/service_worker/service_worker_provider_host.cc b/content/browser/service_worker/service_worker_provider_host.cc
|
| index 6153b93a747902920cd1602d5151efd0853a289b..59bac408d50c63d92523333934f077c7a7684ae8 100644
|
| --- a/content/browser/service_worker/service_worker_provider_host.cc
|
| +++ b/content/browser/service_worker/service_worker_provider_host.cc
|
| @@ -117,7 +117,8 @@ void ServiceWorkerProviderHost::SetControllerVersionAttribute(
|
| return; // Could be NULL in some tests.
|
|
|
| bool should_notify_controllerchange =
|
| - previous_version && version && version->skip_waiting();
|
| + (version && version->claiming_clients()) ||
|
| + (previous_version && version && version->skip_waiting());
|
|
|
| dispatcher_host_->Send(new ServiceWorkerMsg_SetControllerServiceWorker(
|
| kDocumentMainThreadId, provider_id(),
|
| @@ -147,17 +148,27 @@ bool ServiceWorkerProviderHost::SetHostedVersionId(int64 version_id) {
|
| return true;
|
| }
|
|
|
| +void ServiceWorkerProviderHost::UseRegistration(
|
| + ServiceWorkerRegistration* registration) {
|
| + DCHECK(registration->active_version());
|
| + if (associated_registration_ != registration) {
|
| + if (associated_registration_) {
|
| + SetControllerVersionAttribute(NULL);
|
| + DisassociateRegistration();
|
| + }
|
| + AssociateRegistration(registration);
|
| + }
|
| + SetControllerVersionAttribute(registration->active_version());
|
| +}
|
| +
|
| void ServiceWorkerProviderHost::AssociateRegistration(
|
| ServiceWorkerRegistration* registration) {
|
| DCHECK(CanAssociateRegistration(registration));
|
| - if (associated_registration_.get())
|
| - DecreaseProcessReference(associated_registration_->pattern());
|
| IncreaseProcessReference(registration->pattern());
|
|
|
| associated_registration_ = registration;
|
| associated_registration_->AddListener(this);
|
| SendAssociateRegistrationMessage();
|
| - SetControllerVersionAttribute(registration->active_version());
|
| }
|
|
|
| void ServiceWorkerProviderHost::DisassociateRegistration() {
|
| @@ -166,7 +177,6 @@ void ServiceWorkerProviderHost::DisassociateRegistration() {
|
| DecreaseProcessReference(associated_registration_->pattern());
|
| associated_registration_->RemoveListener(this);
|
| associated_registration_ = NULL;
|
| - SetControllerVersionAttribute(NULL);
|
|
|
| if (dispatcher_host_) {
|
| dispatcher_host_->Send(new ServiceWorkerMsg_DisassociateRegistration(
|
|
|