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 47885d1db6ce9625994225d9102cdf3098cebe12..e7f0a9551e7dee10a4581496ab7263de27ad97bc 100644 |
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc |
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc |
@@ -327,21 +327,6 @@ void ServiceWorkerDispatcherHost::OnSetHostedVersionId( |
BadMessageReceived(); |
} |
-ServiceWorkerHandle* ServiceWorkerDispatcherHost::FindHandle(int provider_id, |
- int64 version_id) { |
- for (IDMap<ServiceWorkerHandle, IDMapOwnPointer>::iterator iter(&handles_); |
- !iter.IsAtEnd(); |
- iter.Advance()) { |
- ServiceWorkerHandle* handle = iter.GetCurrentValue(); |
- DCHECK(handle); |
- if (handle->provider_id() == provider_id && handle->version() && |
- handle->version()->version_id() == version_id) { |
- return handle; |
- } |
- } |
- return NULL; |
-} |
- |
ServiceWorkerRegistrationHandle* |
ServiceWorkerDispatcherHost::FindRegistrationHandle(int provider_id, |
int64 registration_id) { |
@@ -374,43 +359,26 @@ void ServiceWorkerDispatcherHost::RegistrationComplete( |
return; |
} |
- ServiceWorkerVersion* version = GetContext()->GetLiveVersion(version_id); |
- DCHECK(version); |
- DCHECK_EQ(registration_id, version->registration_id()); |
- ServiceWorkerObjectInfo info; |
- |
- ServiceWorkerHandle* handle = FindHandle(provider_id, version_id); |
- if (handle) { |
- DCHECK_EQ(thread_id, handle->thread_id()); |
- info = handle->GetObjectInfo(); |
- handle->IncrementRefCount(); |
- } else { |
- scoped_ptr<ServiceWorkerHandle> new_handle = ServiceWorkerHandle::Create( |
- GetContext()->AsWeakPtr(), this, thread_id, provider_id, version); |
- info = new_handle->GetObjectInfo(); |
- RegisterServiceWorkerHandle(new_handle.Pass()); |
- } |
- |
ServiceWorkerRegistration* registration = |
GetContext()->GetLiveRegistration(registration_id); |
DCHECK(registration); |
- ServiceWorkerRegistrationHandle* registration_handle = |
+ ServiceWorkerRegistrationHandle* handle = |
FindRegistrationHandle(provider_id, registration_id); |
- int registration_handle_id = kInvalidServiceWorkerRegistrationHandleId; |
- if (registration_handle) { |
- registration_handle->IncrementRefCount(); |
- registration_handle_id = registration_handle->handle_id(); |
+ ServiceWorkerRegistrationObjectInfo info; |
+ if (handle) { |
+ handle->IncrementRefCount(); |
+ info = handle->GetObjectInfo(); |
} else { |
scoped_ptr<ServiceWorkerRegistrationHandle> new_handle( |
new ServiceWorkerRegistrationHandle( |
GetContext()->AsWeakPtr(), this, provider_id, registration)); |
- registration_handle_id = new_handle->handle_id(); |
+ info = new_handle->GetObjectInfo(); |
RegisterServiceWorkerRegistrationHandle(new_handle.Pass()); |
} |
Send(new ServiceWorkerMsg_ServiceWorkerRegistered( |
- thread_id, request_id, registration_handle_id, info)); |
+ thread_id, request_id, info)); |
} |
void ServiceWorkerDispatcherHost::OnWorkerScriptLoaded(int embedded_worker_id) { |