| 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 0e9f3c97f2bd3bd9ac021b6cb958b4903137f19e..2de8b88307279714cb2493a75286313f6df5f8d4 100644
|
| --- a/content/browser/service_worker/service_worker_dispatcher_host.cc
|
| +++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
|
| @@ -259,23 +259,16 @@ ServiceWorkerHandle* ServiceWorkerDispatcherHost::FindServiceWorkerHandle(
|
| }
|
|
|
| ServiceWorkerRegistrationHandle*
|
| -ServiceWorkerDispatcherHost::GetOrCreateRegistrationHandle(
|
| +ServiceWorkerDispatcherHost::CreateRegistrationHandle(
|
| base::WeakPtr<ServiceWorkerProviderHost> provider_host,
|
| ServiceWorkerRegistration* registration) {
|
| DCHECK(provider_host);
|
| - ServiceWorkerRegistrationHandle* handle =
|
| - FindRegistrationHandle(provider_host->provider_id(), registration->id());
|
| - if (handle) {
|
| - handle->IncrementRefCount();
|
| - return handle;
|
| - }
|
| -
|
| - scoped_ptr<ServiceWorkerRegistrationHandle> new_handle(
|
| - new ServiceWorkerRegistrationHandle(
|
| - GetContext()->AsWeakPtr(), provider_host, registration));
|
| - handle = new_handle.get();
|
| - RegisterServiceWorkerRegistrationHandle(new_handle.Pass());
|
| - return handle;
|
| + scoped_ptr<ServiceWorkerRegistrationHandle> handle(
|
| + new ServiceWorkerRegistrationHandle(GetContext()->AsWeakPtr(),
|
| + provider_host, registration));
|
| + ServiceWorkerRegistrationHandle* handle_ptr = handle.get();
|
| + RegisterServiceWorkerRegistrationHandle(handle.Pass());
|
| + return handle_ptr;
|
| }
|
|
|
| void ServiceWorkerDispatcherHost::OnRegisterServiceWorker(
|
| @@ -796,31 +789,13 @@ void ServiceWorkerDispatcherHost::OnSetHostedVersionId(
|
| kDocumentMainThreadId, provider_id, info, attrs));
|
| }
|
|
|
| -ServiceWorkerRegistrationHandle*
|
| -ServiceWorkerDispatcherHost::FindRegistrationHandle(int provider_id,
|
| - int64 registration_id) {
|
| - for (IDMap<ServiceWorkerRegistrationHandle, IDMapOwnPointer>::iterator
|
| - iter(®istration_handles_);
|
| - !iter.IsAtEnd();
|
| - iter.Advance()) {
|
| - ServiceWorkerRegistrationHandle* handle = iter.GetCurrentValue();
|
| - DCHECK(handle);
|
| - DCHECK(handle->registration());
|
| - if (handle->provider_id() == provider_id &&
|
| - handle->registration()->id() == registration_id) {
|
| - return handle;
|
| - }
|
| - }
|
| - return NULL;
|
| -}
|
| -
|
| void ServiceWorkerDispatcherHost::GetRegistrationObjectInfoAndVersionAttributes(
|
| base::WeakPtr<ServiceWorkerProviderHost> provider_host,
|
| ServiceWorkerRegistration* registration,
|
| ServiceWorkerRegistrationObjectInfo* info,
|
| ServiceWorkerVersionAttributes* attrs) {
|
| ServiceWorkerRegistrationHandle* handle =
|
| - GetOrCreateRegistrationHandle(provider_host, registration);
|
| + CreateRegistrationHandle(provider_host, registration);
|
| *info = handle->GetObjectInfo();
|
|
|
| attrs->installing = provider_host->GetOrCreateServiceWorkerHandle(
|
|
|