| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 if (context_->controller_handle_id() != kInvalidServiceWorkerHandleId) { | 65 if (context_->controller_handle_id() != kInvalidServiceWorkerHandleId) { |
| 66 client->setController(GetDispatcher()->GetServiceWorker( | 66 client->setController(GetDispatcher()->GetServiceWorker( |
| 67 context_->controller()->info(), false)); | 67 context_->controller()->info(), false)); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 void WebServiceWorkerProviderImpl::registerServiceWorker( | 71 void WebServiceWorkerProviderImpl::registerServiceWorker( |
| 72 const WebURL& pattern, | 72 const WebURL& pattern, |
| 73 const WebURL& script_url, | 73 const WebURL& script_url, |
| 74 WebServiceWorkerCallbacks* callbacks) { | 74 WebServiceWorkerRegistrationCallbacks* callbacks) { |
| 75 GetDispatcher()->RegisterServiceWorker( | 75 GetDispatcher()->RegisterServiceWorker( |
| 76 provider_id_, pattern, script_url, callbacks); | 76 provider_id_, pattern, script_url, callbacks); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void WebServiceWorkerProviderImpl::unregisterServiceWorker( | 79 void WebServiceWorkerProviderImpl::unregisterServiceWorker( |
| 80 const WebURL& pattern, | 80 const WebURL& pattern, |
| 81 WebServiceWorkerCallbacks* callbacks) { | 81 WebServiceWorkerRegistrationCallbacks* callbacks) { |
| 82 GetDispatcher()->UnregisterServiceWorker( | 82 GetDispatcher()->UnregisterServiceWorker( |
| 83 provider_id_, pattern, callbacks); | 83 provider_id_, pattern, callbacks); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void WebServiceWorkerProviderImpl::RemoveScriptClient() { | 86 void WebServiceWorkerProviderImpl::RemoveScriptClient() { |
| 87 // Remove the script client, but only if the dispatcher is still there. | 87 // Remove the script client, but only if the dispatcher is still there. |
| 88 // (For cleanup path we don't need to bother creating a new dispatcher) | 88 // (For cleanup path we don't need to bother creating a new dispatcher) |
| 89 ServiceWorkerDispatcher* dispatcher = | 89 ServiceWorkerDispatcher* dispatcher = |
| 90 ServiceWorkerDispatcher::GetThreadSpecificInstance(); | 90 ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
| 91 if (dispatcher) | 91 if (dispatcher) |
| 92 dispatcher->RemoveScriptClient(provider_id_); | 92 dispatcher->RemoveScriptClient(provider_id_); |
| 93 } | 93 } |
| 94 | 94 |
| 95 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { | 95 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { |
| 96 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( | 96 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( |
| 97 thread_safe_sender_); | 97 thread_safe_sender_); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace content | 100 } // namespace content |
| OLD | NEW |