| Index: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
|
| diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
|
| index 7298ac31d2550779bf95890a59d7306399e82cee..efd57b705ecb0132efe521ca599154baee0085e0 100644
|
| --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
|
| +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
|
| @@ -56,8 +56,6 @@
|
| #include "public/platform/modules/serviceworker/WebServiceWorker.h"
|
| #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h"
|
| #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h"
|
| -#include "wtf/PtrUtil.h"
|
| -#include <memory>
|
|
|
| namespace blink {
|
|
|
| @@ -71,7 +69,7 @@ public:
|
| {
|
| if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
|
| return;
|
| - m_resolver->resolve(ServiceWorkerRegistration::getOrCreate(m_resolver->getExecutionContext(), wrapUnique(handle.release())));
|
| + m_resolver->resolve(ServiceWorkerRegistration::getOrCreate(m_resolver->getExecutionContext(), adoptPtr(handle.release())));
|
| }
|
|
|
| void onError(const WebServiceWorkerError& error) override
|
| @@ -98,7 +96,7 @@ public:
|
|
|
| void onSuccess(std::unique_ptr<WebServiceWorkerRegistration::Handle> webPassHandle) override
|
| {
|
| - std::unique_ptr<WebServiceWorkerRegistration::Handle> handle = wrapUnique(webPassHandle.release());
|
| + OwnPtr<WebServiceWorkerRegistration::Handle> handle = adoptPtr(webPassHandle.release());
|
| if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
|
| return;
|
| if (!handle) {
|
| @@ -129,10 +127,10 @@ public:
|
|
|
| void onSuccess(std::unique_ptr<WebVector<WebServiceWorkerRegistration::Handle*>> webPassRegistrations) override
|
| {
|
| - Vector<std::unique_ptr<WebServiceWorkerRegistration::Handle>> handles;
|
| - std::unique_ptr<WebVector<WebServiceWorkerRegistration::Handle*>> webRegistrations = wrapUnique(webPassRegistrations.release());
|
| + Vector<OwnPtr<WebServiceWorkerRegistration::Handle>> handles;
|
| + OwnPtr<WebVector<WebServiceWorkerRegistration::Handle*>> webRegistrations = adoptPtr(webPassRegistrations.release());
|
| for (auto& handle : *webRegistrations) {
|
| - handles.append(wrapUnique(handle));
|
| + handles.append(adoptPtr(handle));
|
| }
|
|
|
| if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
|
| @@ -163,7 +161,7 @@ public:
|
| ASSERT(m_ready->getState() == ReadyProperty::Pending);
|
|
|
| if (m_ready->getExecutionContext() && !m_ready->getExecutionContext()->activeDOMObjectsAreStopped())
|
| - m_ready->resolve(ServiceWorkerRegistration::getOrCreate(m_ready->getExecutionContext(), wrapUnique(handle.release())));
|
| + m_ready->resolve(ServiceWorkerRegistration::getOrCreate(m_ready->getExecutionContext(), adoptPtr(handle.release())));
|
| }
|
|
|
| private:
|
| @@ -197,7 +195,7 @@ DEFINE_TRACE(ServiceWorkerContainer)
|
| ContextLifecycleObserver::trace(visitor);
|
| }
|
|
|
| -void ServiceWorkerContainer::registerServiceWorkerImpl(ExecutionContext* executionContext, const KURL& rawScriptURL, const KURL& scope, std::unique_ptr<RegistrationCallbacks> callbacks)
|
| +void ServiceWorkerContainer::registerServiceWorkerImpl(ExecutionContext* executionContext, const KURL& rawScriptURL, const KURL& scope, PassOwnPtr<RegistrationCallbacks> callbacks)
|
| {
|
| if (!m_provider) {
|
| callbacks->onError(WebServiceWorkerError(WebServiceWorkerError::ErrorTypeState, "Failed to register a ServiceWorker: The document is in an invalid state."));
|
| @@ -257,7 +255,7 @@ void ServiceWorkerContainer::registerServiceWorkerImpl(ExecutionContext* executi
|
| }
|
| }
|
|
|
| - m_provider->registerServiceWorker(patternURL, scriptURL, callbacks.release());
|
| + m_provider->registerServiceWorker(patternURL, scriptURL, callbacks.leakPtr());
|
| }
|
|
|
| ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptState, const String& url, const RegistrationOptions& options)
|
| @@ -284,7 +282,7 @@ ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptS
|
| else
|
| patternURL = enteredExecutionContext(scriptState->isolate())->completeURL(options.scope());
|
|
|
| - registerServiceWorkerImpl(executionContext, scriptURL, patternURL, wrapUnique(new RegistrationCallback(resolver)));
|
| + registerServiceWorkerImpl(executionContext, scriptURL, patternURL, adoptPtr(new RegistrationCallback(resolver)));
|
|
|
| return promise;
|
| }
|
| @@ -387,7 +385,7 @@ void ServiceWorkerContainer::setController(std::unique_ptr<WebServiceWorker::Han
|
| {
|
| if (!getExecutionContext())
|
| return;
|
| - m_controller = ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release()));
|
| + m_controller = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.release()));
|
| if (m_controller)
|
| UseCounter::count(getExecutionContext(), UseCounter::ServiceWorkerControlledPage);
|
| if (shouldNotifyControllerChange)
|
| @@ -401,7 +399,7 @@ void ServiceWorkerContainer::dispatchMessageEvent(std::unique_ptr<WebServiceWork
|
|
|
| MessagePortArray* ports = MessagePort::toMessagePortArray(getExecutionContext(), webChannels);
|
| RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(message);
|
| - ServiceWorker* source = ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release()));
|
| + ServiceWorker* source = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.release()));
|
| dispatchEvent(ServiceWorkerMessageEvent::create(ports, value, source, getExecutionContext()->getSecurityOrigin()->toString()));
|
| }
|
|
|
|
|