Chromium Code Reviews| Index: content/child/service_worker/service_worker_dispatcher.cc |
| diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc |
| index b9da048c199071bdf1ae92aac9ba74b5bd824860..c888df4740ba35fc274c1fee61f3aaf6676646c3 100644 |
| --- a/content/child/service_worker/service_worker_dispatcher.cc |
| +++ b/content/child/service_worker/service_worker_dispatcher.cc |
| @@ -33,7 +33,8 @@ int CurrentWorkerId() { |
| ServiceWorkerDispatcher::ServiceWorkerDispatcher( |
| ThreadSafeSender* thread_safe_sender) |
| - : thread_safe_sender_(thread_safe_sender) { |
| + : thread_safe_sender_(thread_safe_sender), |
| + client_(NULL) { |
|
michaeln
2014/03/07 02:24:09
ditto stale
kinuko
2014/03/07 02:37:13
Done.
|
| g_dispatcher_tls.Pointer()->Set(this); |
| } |
| @@ -77,6 +78,25 @@ void ServiceWorkerDispatcher::UnregisterServiceWorker( |
| CurrentWorkerId(), request_id, pattern)); |
| } |
| +void ServiceWorkerDispatcher::AddScriptClient( |
| + int provider_id, |
| + blink::WebServiceWorkerProviderClient* client) { |
| + DCHECK(client); |
| + DCHECK(!ContainsKey(script_clients_, provider_id)); |
| + script_clients_[provider_id] = client; |
| + thread_safe_sender_->Send(new ServiceWorkerHostMsg_AddScriptClient( |
| + CurrentWorkerId(), provider_id)); |
| +} |
| + |
| +void ServiceWorkerDispatcher::RemoveScriptClient(int provider_id) { |
| + // This could be possibly called multiple times to ensure termination. |
| + if (ContainsKey(script_clients_, provider_id)) { |
| + script_clients_.erase(provider_id); |
| + thread_safe_sender_->Send(new ServiceWorkerHostMsg_RemoveScriptClient( |
| + CurrentWorkerId(), provider_id)); |
| + } |
| +} |
| + |
| ServiceWorkerDispatcher* ServiceWorkerDispatcher::ThreadSpecificInstance( |
| ThreadSafeSender* thread_safe_sender) { |
| if (g_dispatcher_tls.Pointer()->Get() == kHasBeenDeleted) { |