| 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 29 matching lines...) Expand all Loading... |
| 40 return; | 40 return; |
| 41 } | 41 } |
| 42 | 42 |
| 43 // TODO(kinuko): Here we could also register the current thread ID | 43 // TODO(kinuko): Here we could also register the current thread ID |
| 44 // on the provider context so that multiple WebServiceWorkerProviderImpl | 44 // on the provider context so that multiple WebServiceWorkerProviderImpl |
| 45 // (e.g. on document and on dedicated workers) can properly share | 45 // (e.g. on document and on dedicated workers) can properly share |
| 46 // the single provider context across threads. (http://crbug.com/366538 | 46 // the single provider context across threads. (http://crbug.com/366538 |
| 47 // for more context) | 47 // for more context) |
| 48 GetDispatcher()->AddScriptClient(provider_id_, client); | 48 GetDispatcher()->AddScriptClient(provider_id_, client); |
| 49 | 49 |
| 50 if (context_->installing_handle_id() != kInvalidServiceWorkerHandleId) { |
| 51 client->setInstalling(GetDispatcher()->GetServiceWorker( |
| 52 context_->installing()->info(), false)); |
| 53 } |
| 54 |
| 50 if (context_->waiting_handle_id() != kInvalidServiceWorkerHandleId) { | 55 if (context_->waiting_handle_id() != kInvalidServiceWorkerHandleId) { |
| 51 client->setWaiting(GetDispatcher()->GetServiceWorker( | 56 client->setWaiting(GetDispatcher()->GetServiceWorker( |
| 52 context_->waiting()->info(), false)); | 57 context_->waiting()->info(), false)); |
| 53 } | 58 } |
| 54 | 59 |
| 55 if (context_->controller_handle_id() != kInvalidServiceWorkerHandleId) { | 60 if (context_->controller_handle_id() != kInvalidServiceWorkerHandleId) { |
| 56 client->setController(GetDispatcher()->GetServiceWorker( | 61 client->setController(GetDispatcher()->GetServiceWorker( |
| 57 context_->controller()->info(), false)); | 62 context_->controller()->info(), false)); |
| 58 } | 63 } |
| 59 } | 64 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 81 if (dispatcher) | 86 if (dispatcher) |
| 82 dispatcher->RemoveScriptClient(provider_id_); | 87 dispatcher->RemoveScriptClient(provider_id_); |
| 83 } | 88 } |
| 84 | 89 |
| 85 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { | 90 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { |
| 86 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( | 91 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( |
| 87 thread_safe_sender_); | 92 thread_safe_sender_); |
| 88 } | 93 } |
| 89 | 94 |
| 90 } // namespace content | 95 } // namespace content |
| OLD | NEW |