| 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 "content/child/service_worker/service_worker_dispatcher.h" | 7 #include "content/child/service_worker/service_worker_dispatcher.h" |
| 8 #include "content/child/service_worker/service_worker_handle_reference.h" | 8 #include "content/child/service_worker/service_worker_handle_reference.h" |
| 9 #include "content/child/service_worker/service_worker_provider_context.h" | 9 #include "content/child/service_worker/service_worker_provider_context.h" |
| 10 #include "content/child/service_worker/web_service_worker_impl.h" | 10 #include "content/child/service_worker/web_service_worker_impl.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 WebServiceWorkerGetRegistrationsCallbacks* callbacks) { | 75 WebServiceWorkerGetRegistrationsCallbacks* callbacks) { |
| 76 GetDispatcher()->GetRegistrations( | 76 GetDispatcher()->GetRegistrations( |
| 77 context_->provider_id(), callbacks); | 77 context_->provider_id(), callbacks); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void WebServiceWorkerProviderImpl::getRegistrationForReady( | 80 void WebServiceWorkerProviderImpl::getRegistrationForReady( |
| 81 WebServiceWorkerGetRegistrationForReadyCallbacks* callbacks) { | 81 WebServiceWorkerGetRegistrationForReadyCallbacks* callbacks) { |
| 82 GetDispatcher()->GetRegistrationForReady(context_->provider_id(), callbacks); | 82 GetDispatcher()->GetRegistrationForReady(context_->provider_id(), callbacks); |
| 83 } | 83 } |
| 84 | 84 |
| 85 int WebServiceWorkerProviderImpl::provider_id() const { |
| 86 return context_->provider_id(); |
| 87 } |
| 88 |
| 85 void WebServiceWorkerProviderImpl::RemoveProviderClient() { | 89 void WebServiceWorkerProviderImpl::RemoveProviderClient() { |
| 86 // Remove the provider client, but only if the dispatcher is still there. | 90 // Remove the provider client, but only if the dispatcher is still there. |
| 87 // (For cleanup path we don't need to bother creating a new dispatcher) | 91 // (For cleanup path we don't need to bother creating a new dispatcher) |
| 88 ServiceWorkerDispatcher* dispatcher = | 92 ServiceWorkerDispatcher* dispatcher = |
| 89 ServiceWorkerDispatcher::GetThreadSpecificInstance(); | 93 ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
| 90 if (dispatcher) | 94 if (dispatcher) |
| 91 dispatcher->RemoveProviderClient(context_->provider_id()); | 95 dispatcher->RemoveProviderClient(context_->provider_id()); |
| 92 } | 96 } |
| 93 | 97 |
| 94 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { | 98 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { |
| 95 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( | 99 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( |
| 96 thread_safe_sender_.get()); | 100 thread_safe_sender_.get()); |
| 97 } | 101 } |
| 98 | 102 |
| 99 } // namespace content | 103 } // namespace content |
| OLD | NEW |