| Index: content/child/service_worker/service_worker_dispatcher.cc | 
| diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc | 
| index 55b2b9abe53c374d903bda81fe1b2e66f6ad2b63..f9041180dd8344d692c65729120e4b05409ba005 100644 | 
| --- a/content/child/service_worker/service_worker_dispatcher.cc | 
| +++ b/content/child/service_worker/service_worker_dispatcher.cc | 
| @@ -359,10 +359,18 @@ void ServiceWorkerDispatcher::OnAssociateRegistrationWithServiceWorker( | 
| const ServiceWorkerVersionAttributes& attrs) { | 
| DCHECK_EQ(kDocumentMainThreadId, thread_id); | 
|  | 
| +  // Adopt the references sent from the browser process and pass them to the | 
| +  // provider context if it exists. | 
| +  scoped_ptr<ServiceWorkerRegistrationHandleReference> registration = | 
| +      Adopt(info); | 
| +  scoped_ptr<ServiceWorkerHandleReference> installing = Adopt(attrs.installing); | 
| +  scoped_ptr<ServiceWorkerHandleReference> waiting = Adopt(attrs.waiting); | 
| +  scoped_ptr<ServiceWorkerHandleReference> active = Adopt(attrs.active); | 
| ProviderContextMap::iterator context = provider_contexts_.find(provider_id); | 
| -  if (context == provider_contexts_.end()) | 
| -    return; | 
| -  context->second->OnAssociateRegistration(info, attrs); | 
| +  if (context != provider_contexts_.end()) { | 
| +    context->second->OnAssociateRegistration( | 
| +        registration.Pass(), installing.Pass(), waiting.Pass(), active.Pass()); | 
| +  } | 
| } | 
|  | 
| void ServiceWorkerDispatcher::OnAssociateRegistration( | 
| @@ -370,10 +378,18 @@ void ServiceWorkerDispatcher::OnAssociateRegistration( | 
| int provider_id, | 
| const ServiceWorkerRegistrationObjectInfo& info, | 
| const ServiceWorkerVersionAttributes& attrs) { | 
| -  ProviderContextMap::iterator provider = provider_contexts_.find(provider_id); | 
| -  if (provider == provider_contexts_.end()) | 
| -    return; | 
| -  provider->second->OnAssociateRegistration(info, attrs); | 
| +  // Adopt the references sent from the browser process and pass them to the | 
| +  // provider context if it exists. | 
| +  scoped_ptr<ServiceWorkerRegistrationHandleReference> registration = | 
| +      Adopt(info); | 
| +  scoped_ptr<ServiceWorkerHandleReference> installing = Adopt(attrs.installing); | 
| +  scoped_ptr<ServiceWorkerHandleReference> waiting = Adopt(attrs.waiting); | 
| +  scoped_ptr<ServiceWorkerHandleReference> active = Adopt(attrs.active); | 
| +  ProviderContextMap::iterator context = provider_contexts_.find(provider_id); | 
| +  if (context != provider_contexts_.end()) { | 
| +    context->second->OnAssociateRegistration( | 
| +        registration.Pass(), installing.Pass(), waiting.Pass(), active.Pass()); | 
| +  } | 
| } | 
|  | 
| void ServiceWorkerDispatcher::OnDisassociateRegistration( | 
| @@ -776,4 +792,16 @@ void ServiceWorkerDispatcher::RemoveServiceWorkerRegistration( | 
| registrations_.erase(registration_handle_id); | 
| } | 
|  | 
| +scoped_ptr<ServiceWorkerRegistrationHandleReference> | 
| +ServiceWorkerDispatcher::Adopt( | 
| +    const ServiceWorkerRegistrationObjectInfo& info) { | 
| +  return ServiceWorkerRegistrationHandleReference::Adopt( | 
| +      info, thread_safe_sender_.get()); | 
| +} | 
| + | 
| +scoped_ptr<ServiceWorkerHandleReference> ServiceWorkerDispatcher::Adopt( | 
| +    const ServiceWorkerObjectInfo& info) { | 
| +  return ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get()); | 
| +} | 
| + | 
| }  // namespace content | 
|  |