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 ce20a7aac5a7d2400f256b89b62e395281ae773a..b472d571d23a7155ab00fa7dbe1fc1406c1d0c2c 100644 |
--- a/content/child/service_worker/service_worker_dispatcher.cc |
+++ b/content/child/service_worker/service_worker_dispatcher.cc |
@@ -262,6 +262,7 @@ void ServiceWorkerDispatcher::OnWorkerRunLoopStopped() { |
WebServiceWorkerImpl* ServiceWorkerDispatcher::GetServiceWorker( |
const ServiceWorkerObjectInfo& info, |
+ int provider_id, |
bool adopt_handle) { |
if (info.handle_id == kInvalidServiceWorkerHandleId) |
return NULL; |
@@ -284,7 +285,8 @@ WebServiceWorkerImpl* ServiceWorkerDispatcher::GetServiceWorker( |
: ServiceWorkerHandleReference::Create(info, |
thread_safe_sender_.get()); |
// WebServiceWorkerImpl constructor calls AddServiceWorker. |
- return new WebServiceWorkerImpl(handle_ref.Pass(), thread_safe_sender_.get()); |
+ return new WebServiceWorkerImpl(handle_ref.Pass(), provider_id, |
+ thread_safe_sender_.get()); |
} |
WebServiceWorkerRegistrationImpl* |
@@ -360,6 +362,7 @@ void ServiceWorkerDispatcher::OnDisassociateRegistration( |
void ServiceWorkerDispatcher::OnRegistered( |
int thread_id, |
int request_id, |
+ int provider_id, |
const ServiceWorkerRegistrationObjectInfo& info, |
const ServiceWorkerVersionAttributes& attrs) { |
TRACE_EVENT_ASYNC_STEP_INTO0("ServiceWorker", |
@@ -375,7 +378,7 @@ void ServiceWorkerDispatcher::OnRegistered( |
if (!callbacks) |
return; |
- callbacks->onSuccess(FindOrCreateRegistration(info, attrs)); |
+ callbacks->onSuccess(FindOrCreateRegistration(provider_id, info, attrs)); |
pending_registration_callbacks_.Remove(request_id); |
} |
@@ -402,6 +405,7 @@ void ServiceWorkerDispatcher::OnUnregistered(int thread_id, |
void ServiceWorkerDispatcher::OnDidGetRegistration( |
int thread_id, |
int request_id, |
+ int provider_id, |
const ServiceWorkerRegistrationObjectInfo& info, |
const ServiceWorkerVersionAttributes& attrs) { |
TRACE_EVENT_ASYNC_STEP_INTO0( |
@@ -420,7 +424,7 @@ void ServiceWorkerDispatcher::OnDidGetRegistration( |
WebServiceWorkerRegistrationImpl* registration = NULL; |
if (info.handle_id != kInvalidServiceWorkerHandleId) |
- registration = FindOrCreateRegistration(info, attrs); |
+ registration = FindOrCreateRegistration(provider_id, info, attrs); |
callbacks->onSuccess(registration); |
pending_get_registration_callbacks_.Remove(request_id); |
@@ -429,6 +433,7 @@ void ServiceWorkerDispatcher::OnDidGetRegistration( |
void ServiceWorkerDispatcher::OnDidGetRegistrations( |
int thread_id, |
int request_id, |
+ int provider_id, |
const std::vector<ServiceWorkerRegistrationObjectInfo>& infos, |
const std::vector<ServiceWorkerVersionAttributes>& attrs) { |
TRACE_EVENT_ASYNC_STEP_INTO0( |
@@ -454,7 +459,7 @@ void ServiceWorkerDispatcher::OnDidGetRegistrations( |
if (infos[i].handle_id != kInvalidServiceWorkerHandleId) { |
ServiceWorkerRegistrationObjectInfo info(infos[i]); |
ServiceWorkerVersionAttributes attr(attrs[i]); |
- (*registrations)[i] = FindOrCreateRegistration(info, attr); |
+ (*registrations)[i] = FindOrCreateRegistration(provider_id, info, attr); |
} |
} |
@@ -465,6 +470,7 @@ void ServiceWorkerDispatcher::OnDidGetRegistrations( |
void ServiceWorkerDispatcher::OnDidGetRegistrationForReady( |
int thread_id, |
int request_id, |
+ int provider_id, |
const ServiceWorkerRegistrationObjectInfo& info, |
const ServiceWorkerVersionAttributes& attrs) { |
TRACE_EVENT_ASYNC_STEP_INTO0( |
@@ -483,7 +489,7 @@ void ServiceWorkerDispatcher::OnDidGetRegistrationForReady( |
WebServiceWorkerRegistrationImpl* registration = NULL; |
DCHECK(info.handle_id != kInvalidServiceWorkerHandleId); |
- registration = FindOrCreateRegistration(info, attrs); |
+ registration = FindOrCreateRegistration(provider_id, info, attrs); |
callbacks->onSuccess(registration); |
get_for_ready_callbacks_.Remove(request_id); |
} |
@@ -641,11 +647,14 @@ void ServiceWorkerDispatcher::OnSetVersionAttributes( |
if (found != registrations_.end()) { |
// Populate the version fields (eg. .installing) with new worker objects. |
if (mask.installing_changed()) |
- found->second->SetInstalling(GetServiceWorker(attrs.installing, false)); |
+ found->second->SetInstalling( |
+ GetServiceWorker(attrs.installing, provider_id, false)); |
if (mask.waiting_changed()) |
- found->second->SetWaiting(GetServiceWorker(attrs.waiting, false)); |
+ found->second->SetWaiting( |
+ GetServiceWorker(attrs.waiting, provider_id, false)); |
if (mask.active_changed()) |
- found->second->SetActive(GetServiceWorker(attrs.active, false)); |
+ found->second->SetActive( |
+ GetServiceWorker(attrs.active, provider_id, false)); |
} |
} |
@@ -681,7 +690,7 @@ void ServiceWorkerDispatcher::OnSetControllerServiceWorker( |
ProviderClientMap::iterator found = provider_clients_.find(provider_id); |
if (found != provider_clients_.end()) { |
// Populate the .controller field with the new worker object. |
- found->second->setController(GetServiceWorker(info, false), |
+ found->second->setController(GetServiceWorker(info, provider_id, false), |
should_notify_controllerchange); |
} |
} |
@@ -708,7 +717,8 @@ void ServiceWorkerDispatcher::OnPostMessage( |
base::ThreadTaskRunnerHandle::Get()); |
found->second->dispatchMessageEvent( |
- GetServiceWorker(params.service_worker_info, false /* adopt_handle */), |
+ GetServiceWorker(params.service_worker_info, params.provider_id, |
+ false /* adopt_handle */), |
params.message, ports); |
} |
@@ -738,6 +748,7 @@ void ServiceWorkerDispatcher::RemoveServiceWorkerRegistration( |
WebServiceWorkerRegistrationImpl* |
ServiceWorkerDispatcher::FindOrCreateRegistration( |
+ int provider_id, |
const ServiceWorkerRegistrationObjectInfo& info, |
const ServiceWorkerVersionAttributes& attrs) { |
RegistrationObjectMap::iterator found = registrations_.find(info.handle_id); |
@@ -756,9 +767,12 @@ ServiceWorkerDispatcher::FindOrCreateRegistration( |
bool adopt_handle = true; |
WebServiceWorkerRegistrationImpl* registration = |
CreateServiceWorkerRegistration(info, adopt_handle); |
- registration->SetInstalling(GetServiceWorker(attrs.installing, adopt_handle)); |
- registration->SetWaiting(GetServiceWorker(attrs.waiting, adopt_handle)); |
- registration->SetActive(GetServiceWorker(attrs.active, adopt_handle)); |
+ registration->SetInstalling( |
+ GetServiceWorker(attrs.installing, provider_id, adopt_handle)); |
+ registration->SetWaiting( |
+ GetServiceWorker(attrs.waiting, provider_id, adopt_handle)); |
+ registration->SetActive( |
+ GetServiceWorker(attrs.active, provider_id, adopt_handle)); |
return registration; |
} |