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 44d5b796cc17791de8f48d6c013f442d26eb09ab..b2aa8c23ea51a9b1a019a06b9f0473bef6f038fe 100644 |
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc |
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc |
@@ -329,6 +329,25 @@ void ServiceWorkerDispatcherHost::OnSetHostedVersionId( |
BadMessageReceived(); |
} |
+ServiceWorkerRegistrationObjectInfo |
+ServiceWorkerDispatcherHost::GetOrCreateRegistrationHandle( |
+ int provider_id, |
+ ServiceWorkerRegistration* registration) { |
+ ServiceWorkerRegistrationHandle* handle = |
+ FindRegistrationHandle(provider_id, registration->id()); |
+ if (handle) { |
+ handle->IncrementRefCount(); |
+ return handle->GetObjectInfo(); |
+ } |
+ |
+ scoped_ptr<ServiceWorkerRegistrationHandle> new_handle( |
+ new ServiceWorkerRegistrationHandle( |
+ GetContext()->AsWeakPtr(), this, provider_id, registration)); |
+ ServiceWorkerRegistrationObjectInfo info = new_handle->GetObjectInfo(); |
+ RegisterServiceWorkerRegistrationHandle(new_handle.Pass()); |
+ return info; |
+} |
+ |
ServiceWorkerRegistrationHandle* |
ServiceWorkerDispatcherHost::FindRegistrationHandle(int provider_id, |
int64 registration_id) { |
@@ -365,20 +384,12 @@ void ServiceWorkerDispatcherHost::RegistrationComplete( |
GetContext()->GetLiveRegistration(registration_id); |
DCHECK(registration); |
+ ServiceWorkerRegistrationObjectInfo info = |
+ GetOrCreateRegistrationHandle(provider_id, registration); |
michaeln
2014/09/04 00:27:23
seems like GetOrCreateRegistrationHandle() should
nhiroki
2014/09/08 15:55:51
Done in the separate CL (https://codereview.chromi
|
+ |
ServiceWorkerRegistrationHandle* handle = |
FindRegistrationHandle(provider_id, registration_id); |
- ServiceWorkerRegistrationObjectInfo info; |
- if (handle) { |
- handle->IncrementRefCount(); |
- info = handle->GetObjectInfo(); |
- } else { |
- scoped_ptr<ServiceWorkerRegistrationHandle> new_handle( |
- new ServiceWorkerRegistrationHandle( |
- GetContext()->AsWeakPtr(), this, provider_id, registration)); |
- info = new_handle->GetObjectInfo(); |
- handle = new_handle.get(); |
- RegisterServiceWorkerRegistrationHandle(new_handle.Pass()); |
- } |
+ DCHECK(handle); |
ServiceWorkerVersionAttributes attrs; |
attrs.installing = handle->CreateServiceWorkerHandleAndPass( |