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 28 matching lines...) Expand all Loading... |
39 // TODO(kinuko): Here we could also register the current thread ID | 39 // TODO(kinuko): Here we could also register the current thread ID |
40 // on the provider context so that multiple WebServiceWorkerProviderImpl | 40 // on the provider context so that multiple WebServiceWorkerProviderImpl |
41 // (e.g. on document and on dedicated workers) can properly share | 41 // (e.g. on document and on dedicated workers) can properly share |
42 // the single provider context across threads. (http://crbug.com/366538 | 42 // the single provider context across threads. (http://crbug.com/366538 |
43 // for more context) | 43 // for more context) |
44 GetDispatcher()->AddProviderClient(context_->provider_id(), client); | 44 GetDispatcher()->AddProviderClient(context_->provider_id(), client); |
45 | 45 |
46 if (!context_->controller()) | 46 if (!context_->controller()) |
47 return; | 47 return; |
48 client->setController( | 48 client->setController( |
49 GetDispatcher()->GetServiceWorker(context_->controller()->info(), false), | 49 GetDispatcher()->GetServiceWorker(context_->controller()->info(), |
| 50 context_->provider_id(), false), |
50 false /* shouldNotifyControllerChange */); | 51 false /* shouldNotifyControllerChange */); |
51 } | 52 } |
52 | 53 |
53 void WebServiceWorkerProviderImpl::registerServiceWorker( | 54 void WebServiceWorkerProviderImpl::registerServiceWorker( |
54 const WebURL& pattern, | 55 const WebURL& pattern, |
55 const WebURL& script_url, | 56 const WebURL& script_url, |
56 WebServiceWorkerRegistrationCallbacks* callbacks) { | 57 WebServiceWorkerRegistrationCallbacks* callbacks) { |
57 GetDispatcher()->RegisterServiceWorker( | 58 GetDispatcher()->RegisterServiceWorker( |
58 context_->provider_id(), pattern, script_url, callbacks); | 59 context_->provider_id(), pattern, script_url, callbacks); |
59 } | 60 } |
(...skipping 28 matching lines...) Expand all Loading... |
88 if (dispatcher) | 89 if (dispatcher) |
89 dispatcher->RemoveProviderClient(context_->provider_id()); | 90 dispatcher->RemoveProviderClient(context_->provider_id()); |
90 } | 91 } |
91 | 92 |
92 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { | 93 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { |
93 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( | 94 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( |
94 thread_safe_sender_.get()); | 95 thread_safe_sender_.get()); |
95 } | 96 } |
96 | 97 |
97 } // namespace content | 98 } // namespace content |
OLD | NEW |