| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/child/service_worker/service_worker_dispatcher.h" | 5 #include "content/child/service_worker/service_worker_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 if (provider == provider_contexts_.end() || | 578 if (provider == provider_contexts_.end() || |
| 579 provider->second->registration_handle_id() != registration_handle_id || | 579 provider->second->registration_handle_id() != registration_handle_id || |
| 580 provider->second->active_handle_id() == kInvalidServiceWorkerHandleId) { | 580 provider->second->active_handle_id() == kInvalidServiceWorkerHandleId) { |
| 581 return; | 581 return; |
| 582 } | 582 } |
| 583 | 583 |
| 584 ProviderClientMap::iterator client = provider_clients_.find(provider_id); | 584 ProviderClientMap::iterator client = provider_clients_.find(provider_id); |
| 585 if (client == provider_clients_.end()) | 585 if (client == provider_clients_.end()) |
| 586 return; | 586 return; |
| 587 | 587 |
| 588 ServiceWorkerRegistrationObjectInfo info = | 588 ServiceWorkerRegistrationObjectInfo info; |
| 589 provider->second->registration()->info(); | 589 ServiceWorkerVersionAttributes attrs; |
| 590 provider->second->GetRegistrationInfoAndVersionAttributes(&info, &attrs); |
| 591 |
| 590 WebServiceWorkerRegistrationImpl* registration = | 592 WebServiceWorkerRegistrationImpl* registration = |
| 591 FindServiceWorkerRegistration(info, false); | 593 FindServiceWorkerRegistration(info, false); |
| 592 if (!registration) { | 594 if (!registration) { |
| 593 registration = CreateServiceWorkerRegistration(info, false); | 595 registration = CreateServiceWorkerRegistration(info, false); |
| 594 ServiceWorkerVersionAttributes attrs = | |
| 595 provider->second->GetVersionAttributes(); | |
| 596 registration->SetInstalling(GetServiceWorker(attrs.installing, false)); | 596 registration->SetInstalling(GetServiceWorker(attrs.installing, false)); |
| 597 registration->SetWaiting(GetServiceWorker(attrs.waiting, false)); | 597 registration->SetWaiting(GetServiceWorker(attrs.waiting, false)); |
| 598 registration->SetActive(GetServiceWorker(attrs.active, false)); | 598 registration->SetActive(GetServiceWorker(attrs.active, false)); |
| 599 } | 599 } |
| 600 | 600 |
| 601 // Resolve the .ready promise with the registration object. | 601 // Resolve the .ready promise with the registration object. |
| 602 client->second->setReadyRegistration(registration); | 602 client->second->setReadyRegistration(registration); |
| 603 } | 603 } |
| 604 | 604 |
| 605 void ServiceWorkerDispatcher::OnSetControllerServiceWorker( | 605 void ServiceWorkerDispatcher::OnSetControllerServiceWorker( |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 attrs.installing, thread_safe_sender_.get()); | 727 attrs.installing, thread_safe_sender_.get()); |
| 728 ServiceWorkerHandleReference::Adopt( | 728 ServiceWorkerHandleReference::Adopt( |
| 729 attrs.waiting, thread_safe_sender_.get()); | 729 attrs.waiting, thread_safe_sender_.get()); |
| 730 ServiceWorkerHandleReference::Adopt( | 730 ServiceWorkerHandleReference::Adopt( |
| 731 attrs.active, thread_safe_sender_.get()); | 731 attrs.active, thread_safe_sender_.get()); |
| 732 } | 732 } |
| 733 return registration; | 733 return registration; |
| 734 } | 734 } |
| 735 | 735 |
| 736 } // namespace content | 736 } // namespace content |
| OLD | NEW |