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/web_service_worker_provider_impl.h" | 5 #include "content/child/service_worker/web_service_worker_provider_impl.h" |
6 | 6 |
7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/child/child_thread.h" | 9 #include "content/child/child_thread.h" |
10 #include "content/child/service_worker/service_worker_dispatcher.h" | 10 #include "content/child/service_worker/service_worker_dispatcher.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if (!context_->GetRegistrationInfoAndVersionAttributes(&info, &attrs)) { | 54 if (!context_->GetRegistrationInfoAndVersionAttributes(&info, &attrs)) { |
55 // This provider is not associated with any registration. | 55 // This provider is not associated with any registration. |
56 return; | 56 return; |
57 } | 57 } |
58 | 58 |
59 // Set .ready if the associated registration has the active service worker. | 59 // Set .ready if the associated registration has the active service worker. |
60 if (context_->active_handle_id() != kInvalidServiceWorkerHandleId) { | 60 if (context_->active_handle_id() != kInvalidServiceWorkerHandleId) { |
61 WebServiceWorkerRegistrationImpl* registration = | 61 WebServiceWorkerRegistrationImpl* registration = |
62 GetDispatcher()->FindServiceWorkerRegistration(info, false); | 62 GetDispatcher()->FindServiceWorkerRegistration(info, false); |
63 if (!registration) { | 63 if (!registration) { |
64 registration = | 64 registration = GetDispatcher()->CreateServiceWorkerRegistration( |
65 GetDispatcher()->CreateServiceWorkerRegistration(info, false); | 65 provider_id_, info, false); |
66 registration->SetInstalling( | 66 registration->SetInstalling( |
67 GetDispatcher()->GetServiceWorker(attrs.installing, false)); | 67 GetDispatcher()->GetServiceWorker(attrs.installing, false)); |
68 registration->SetWaiting( | 68 registration->SetWaiting( |
69 GetDispatcher()->GetServiceWorker(attrs.waiting, false)); | 69 GetDispatcher()->GetServiceWorker(attrs.waiting, false)); |
70 registration->SetActive( | 70 registration->SetActive( |
71 GetDispatcher()->GetServiceWorker(attrs.active, false)); | 71 GetDispatcher()->GetServiceWorker(attrs.active, false)); |
72 } | 72 } |
73 client->setReadyRegistration(registration); | 73 client->setReadyRegistration(registration); |
74 } | 74 } |
75 | 75 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 if (dispatcher) | 109 if (dispatcher) |
110 dispatcher->RemoveProviderClient(provider_id_); | 110 dispatcher->RemoveProviderClient(provider_id_); |
111 } | 111 } |
112 | 112 |
113 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { | 113 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { |
114 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( | 114 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( |
115 thread_safe_sender_.get()); | 115 thread_safe_sender_.get()); |
116 } | 116 } |
117 | 117 |
118 } // namespace content | 118 } // namespace content |
OLD | NEW |