Chromium Code Reviews| Index: content/browser/service_worker/service_worker_dispatcher_host.cc |
| diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc |
| index 162047ccb9ad4fdd7d11cea917394bd086320027..58c13c980e6a50615e380c4409bd2f47b394b050 100644 |
| --- a/content/browser/service_worker/service_worker_dispatcher_host.cc |
| +++ b/content/browser/service_worker/service_worker_dispatcher_host.cc |
| @@ -80,6 +80,10 @@ bool ServiceWorkerDispatcherHost::OnMessageReceived( |
| OnProviderCreated) |
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ProviderDestroyed, |
| OnProviderDestroyed) |
| + IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_AddScriptClient, |
| + OnAddScriptClient) |
| + IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_RemoveScriptClient, |
| + OnRemoveScriptClient) |
| IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_WorkerStarted, |
| OnWorkerStarted) |
| IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_WorkerStopped, |
| @@ -175,6 +179,32 @@ void ServiceWorkerDispatcherHost::OnProviderDestroyed(int provider_id) { |
| context_->RemoveProviderHost(render_process_id_, provider_id); |
| } |
| +void ServiceWorkerDispatcherHost::OnAddScriptClient( |
| + int thread_id, int provider_id) { |
| + if (!context_) |
| + return; |
| + ServiceWorkerProviderHost* provider_host = |
| + context_->GetProviderHost(render_process_id_, provider_id); |
| + if (!provider_host) { |
|
michaeln
2014/03/07 02:24:09
This might not be indicative of a bad message depe
kinuko
2014/03/07 02:37:13
Hmm, good point. Changed to just return in null c
|
| + BadMessageReceived(); |
| + return; |
| + } |
| + provider_host->AddScriptClient(thread_id); |
| +} |
| + |
| +void ServiceWorkerDispatcherHost::OnRemoveScriptClient( |
| + int thread_id, int provider_id) { |
| + if (!context_) |
| + return; |
| + ServiceWorkerProviderHost* provider_host = |
| + context_->GetProviderHost(render_process_id_, provider_id); |
| + if (!provider_host) { |
|
michaeln
2014/03/07 02:24:09
ditto can we trust blink on this?
|
| + BadMessageReceived(); |
| + return; |
| + } |
| + provider_host->RemoveScriptClient(thread_id); |
| +} |
| + |
| void ServiceWorkerDispatcherHost::RegistrationComplete( |
| int32 thread_id, |
| int32 request_id, |