| Index: Source/modules/serviceworkers/ServiceWorkerRegistration.cpp
|
| diff --git a/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp b/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp
|
| index e3bfd95b556cf00e9e022fe757712fd2a8fea609..8cc1537d3a58b972924cd513846e9fdec9ca2e35 100644
|
| --- a/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp
|
| +++ b/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp
|
| @@ -63,22 +63,18 @@ void ServiceWorkerRegistration::setActive(WebServiceWorker* serviceWorker)
|
| m_active = ServiceWorker::from(executionContext(), serviceWorker);
|
| }
|
|
|
| -ServiceWorkerRegistration* ServiceWorkerRegistration::from(ExecutionContext* executionContext, WebServiceWorkerRegistration* registration)
|
| +ServiceWorkerRegistration* ServiceWorkerRegistration::create(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorkerRegistration> webRegistration)
|
| {
|
| - if (!registration)
|
| - return 0;
|
| - return getOrCreate(executionContext, registration);
|
| -}
|
| -
|
| -ServiceWorkerRegistration* ServiceWorkerRegistration::take(ScriptPromiseResolver* resolver, WebServiceWorkerRegistration* registration)
|
| -{
|
| - return from(resolver->scriptState()->executionContext(), registration);
|
| + if (!webRegistration)
|
| + return nullptr;
|
| + ServiceWorkerRegistration* registration = new ServiceWorkerRegistration(executionContext, webRegistration);
|
| + registration->suspendIfNeeded();
|
| + return registration;
|
| }
|
|
|
| -void ServiceWorkerRegistration::dispose(WebServiceWorkerRegistration* registration)
|
| +ServiceWorkerRegistration* ServiceWorkerRegistration::take(ScriptPromiseResolver* resolver, PassOwnPtr<WebServiceWorkerRegistration> registration)
|
| {
|
| - if (registration && !registration->proxy())
|
| - delete registration;
|
| + return create(resolver->scriptState()->executionContext(), registration);
|
| }
|
|
|
| String ServiceWorkerRegistration::scope() const
|
| @@ -114,29 +110,14 @@ ScriptPromise ServiceWorkerRegistration::unregister(ScriptState* scriptState)
|
| return promise;
|
| }
|
|
|
| -ServiceWorkerRegistration* ServiceWorkerRegistration::getOrCreate(ExecutionContext* executionContext, WebServiceWorkerRegistration* outerRegistration)
|
| -{
|
| - if (!outerRegistration)
|
| - return 0;
|
| -
|
| - ServiceWorkerRegistration* existingRegistration = static_cast<ServiceWorkerRegistration*>(outerRegistration->proxy());
|
| - if (existingRegistration) {
|
| - ASSERT(existingRegistration->executionContext() == executionContext);
|
| - return existingRegistration;
|
| - }
|
| -
|
| - ServiceWorkerRegistration* registration = new ServiceWorkerRegistration(executionContext, adoptPtr(outerRegistration));
|
| - registration->suspendIfNeeded();
|
| - return registration;
|
| -}
|
| -
|
| ServiceWorkerRegistration::ServiceWorkerRegistration(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorkerRegistration> outerRegistration)
|
| : ActiveDOMObject(executionContext)
|
| , m_outerRegistration(outerRegistration)
|
| - , m_provider(0)
|
| + , m_provider(nullptr)
|
| , m_stopped(false)
|
| {
|
| ASSERT(m_outerRegistration);
|
| + ASSERT(!m_outerRegistration->proxy());
|
|
|
| if (!executionContext)
|
| return;
|
|
|