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 f36af0737b6e5062079a0d393a7d30db98c4f7c2..e72736192e7bdd404b0cdb1ba2f973097ba89fac 100644 |
| --- a/content/browser/service_worker/service_worker_dispatcher_host.cc |
| +++ b/content/browser/service_worker/service_worker_dispatcher_host.cc |
| @@ -98,10 +98,6 @@ 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(ServiceWorkerHostMsg_SetVersionId, |
| OnSetHostedVersionId) |
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_PostMessage, |
| @@ -114,8 +110,10 @@ bool ServiceWorkerDispatcherHost::OnMessageReceived( |
| OnReportException) |
| IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_ReportConsoleMessage, |
| OnReportConsoleMessage) |
| - IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ServiceWorkerObjectDestroyed, |
| - OnServiceWorkerObjectDestroyed) |
| + IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_IncrementServiceWorkerRefCount, |
| + OnIncrementServiceWorkerRefCount) |
| + IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount, |
| + OnDecrementServiceWorkerRefCount) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| @@ -272,28 +270,6 @@ 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) |
| - 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) |
| - return; |
| - provider_host->RemoveScriptClient(thread_id); |
| -} |
| - |
| void ServiceWorkerDispatcherHost::OnSetHostedVersionId( |
| int provider_id, int64 version_id) { |
| if (!context_) |
| @@ -374,9 +350,18 @@ void ServiceWorkerDispatcherHost::OnReportConsoleMessage( |
| params.source_url); |
| } |
| -void ServiceWorkerDispatcherHost::OnServiceWorkerObjectDestroyed( |
| +void ServiceWorkerDispatcherHost::OnIncrementServiceWorkerRefCount( |
| int handle_id) { |
| - handles_.Remove(handle_id); |
| + ServiceWorkerHandle* handle = handles_.Lookup(handle_id); |
|
michaeln
2014/05/01 01:25:18
some bad message detection here might be good, wha
kinuko
2014/05/02 10:00:56
Done.
|
| + handle->IncrementRefCount(); |
| +} |
| + |
| +void ServiceWorkerDispatcherHost::OnDecrementServiceWorkerRefCount( |
| + int handle_id) { |
| + ServiceWorkerHandle* handle = handles_.Lookup(handle_id); |
|
michaeln
2014/05/01 01:25:18
ditto what if null
kinuko
2014/05/02 10:00:56
Done.
|
| + handle->DecrementRefCount(); |
| + if (handle->HasNoRefCount()) |
| + handles_.Remove(handle_id); |
| } |
| void ServiceWorkerDispatcherHost::UnregistrationComplete( |