Chromium Code Reviews| 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 bd0c5ea3197e310de114dc2618f42abc0db0618d..0157d3a48bb4e5f7229882421584cf3d0f8aa2e3 100644 |
| --- a/content/browser/service_worker/service_worker_provider_host.cc |
| +++ b/content/browser/service_worker/service_worker_provider_host.cc |
| @@ -144,21 +144,43 @@ bool ServiceWorkerProviderHost::SetHostedVersionId(int64 version_id) { |
| void ServiceWorkerProviderHost::AssociateRegistration( |
| ServiceWorkerRegistration* registration) { |
| DCHECK(CanAssociateRegistration(registration)); |
| + |
| + if (dispatcher_host_) { |
| + ServiceWorkerRegistrationHandle* handle = |
| + dispatcher_host_->GetOrCreateRegistrationHandle( |
| + provider_id(), registration); |
| + |
| + ServiceWorkerVersionAttributes attrs; |
| + attrs.installing = handle->CreateServiceWorkerHandleAndPass( |
| + registration->installing_version()); |
| + attrs.waiting = handle->CreateServiceWorkerHandleAndPass( |
| + registration->waiting_version()); |
| + attrs.active = handle->CreateServiceWorkerHandleAndPass( |
| + registration->active_version()); |
| + |
| + dispatcher_host_->Send(new ServiceWorkerMsg_AssociateRegistration( |
| + kDocumentMainThreadId, provider_id(), handle->GetObjectInfo(), attrs)); |
|
nasko
2014/09/10 01:15:56
nit: Is this expected to change in the immediate f
nhiroki
2014/09/10 01:50:47
Good point. I think we don't have any plan to chan
nasko
2014/09/10 04:15:10
Fixing in another CL is fine. Please file a bug so
nhiroki
2014/09/10 05:28:47
I took a deeper look and found that this is not al
|
| + } |
| + |
| associated_registration_ = registration; |
| - registration->AddListener(this); |
| + associated_registration_->AddListener(this); |
| UpdatePotentialControllees(registration->installing_version(), |
| registration->waiting_version(), |
| registration->active_version()); |
| - SetControllerVersionAttribute(registration->active_version()); |
| } |
| void ServiceWorkerProviderHost::UnassociateRegistration() { |
| if (!associated_registration_.get()) |
| return; |
| - associated_registration_->RemoveListener(this); |
| - associated_registration_ = NULL; |
| UpdatePotentialControllees(NULL, NULL, NULL); |
| SetControllerVersionAttribute(NULL); |
|
michaeln
2014/09/09 02:22:02
does the change in order of operations matter here
nhiroki
2014/09/09 08:49:08
Just to make consistent with AssociateRegistration
|
| + associated_registration_->RemoveListener(this); |
| + associated_registration_ = NULL; |
| + |
| + if (dispatcher_host_) { |
| + dispatcher_host_->Send(new ServiceWorkerMsg_UnassociateRegistration( |
| + kDocumentMainThreadId, provider_id())); |
| + } |
| } |
| scoped_ptr<ServiceWorkerRequestHandler> |