| 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/service_worker/service_worker_dispatcher.h" | 9 #include "content/child/service_worker/service_worker_dispatcher.h" |
| 10 #include "content/child/service_worker/service_worker_handle_reference.h" | 10 #include "content/child/service_worker/service_worker_handle_reference.h" |
| 11 #include "content/child/service_worker/service_worker_message_sender.h" | |
| 12 #include "content/child/service_worker/service_worker_provider_context.h" | 11 #include "content/child/service_worker/service_worker_provider_context.h" |
| 13 #include "content/child/service_worker/service_worker_registration_handle_refere
nce.h" | 12 #include "content/child/service_worker/service_worker_registration_handle_refere
nce.h" |
| 14 #include "content/child/service_worker/web_service_worker_impl.h" | 13 #include "content/child/service_worker/web_service_worker_impl.h" |
| 15 #include "content/child/service_worker/web_service_worker_registration_impl.h" | 14 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
| 16 #include "content/child/thread_safe_sender.h" | 15 #include "content/child/thread_safe_sender.h" |
| 17 #include "content/common/service_worker/service_worker_messages.h" | 16 #include "content/common/service_worker/service_worker_messages.h" |
| 18 #include "third_party/WebKit/public/platform/WebServiceWorkerProviderClient.h" | 17 #include "third_party/WebKit/public/platform/WebServiceWorkerProviderClient.h" |
| 19 #include "third_party/WebKit/public/platform/WebURL.h" | 18 #include "third_party/WebKit/public/platform/WebURL.h" |
| 20 | 19 |
| 21 using blink::WebURL; | 20 using blink::WebURL; |
| 22 | 21 |
| 23 namespace content { | 22 namespace content { |
| 24 | 23 |
| 25 WebServiceWorkerProviderImpl::WebServiceWorkerProviderImpl( | 24 WebServiceWorkerProviderImpl::WebServiceWorkerProviderImpl( |
| 26 ThreadSafeSender* thread_safe_sender, | 25 ThreadSafeSender* thread_safe_sender, |
| 27 ServiceWorkerProviderContext* context) | 26 ServiceWorkerProviderContext* context) |
| 28 : sender_(new ServiceWorkerMessageSender(thread_safe_sender)), | 27 : thread_safe_sender_(thread_safe_sender), |
| 29 context_(context), | 28 context_(context), |
| 30 provider_id_(context->provider_id()) { | 29 provider_id_(context->provider_id()) { |
| 31 } | 30 } |
| 32 | 31 |
| 33 WebServiceWorkerProviderImpl::~WebServiceWorkerProviderImpl() { | 32 WebServiceWorkerProviderImpl::~WebServiceWorkerProviderImpl() { |
| 34 // Make sure the provider client is removed. | 33 // Make sure the provider client is removed. |
| 35 RemoveProviderClient(); | 34 RemoveProviderClient(); |
| 36 } | 35 } |
| 37 | 36 |
| 38 void WebServiceWorkerProviderImpl::setClient( | 37 void WebServiceWorkerProviderImpl::setClient( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // Remove the provider client, but only if the dispatcher is still there. | 91 // Remove the provider client, but only if the dispatcher is still there. |
| 93 // (For cleanup path we don't need to bother creating a new dispatcher) | 92 // (For cleanup path we don't need to bother creating a new dispatcher) |
| 94 ServiceWorkerDispatcher* dispatcher = | 93 ServiceWorkerDispatcher* dispatcher = |
| 95 ServiceWorkerDispatcher::GetThreadSpecificInstance(); | 94 ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
| 96 if (dispatcher) | 95 if (dispatcher) |
| 97 dispatcher->RemoveProviderClient(provider_id_); | 96 dispatcher->RemoveProviderClient(provider_id_); |
| 98 } | 97 } |
| 99 | 98 |
| 100 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { | 99 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { |
| 101 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( | 100 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( |
| 102 sender_.get()); | 101 thread_safe_sender_.get()); |
| 103 } | 102 } |
| 104 | 103 |
| 105 } // namespace content | 104 } // namespace content |
| OLD | NEW |