Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1176)

Unified Diff: Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp

Issue 1317473002: ServiceWorker: Clean up ownership management of WebServiceWorkerRegistration (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporate review comment Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp b/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
index 455cc300237680851e5e2f79210cf2b0e04b751b..ecdf859ec10044a444cf96871151497c9d6c539b 100644
--- a/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
@@ -154,13 +154,13 @@ ScriptPromise ServiceWorkerGlobalScope::skipWaiting(ScriptState* scriptState)
return promise;
}
-void ServiceWorkerGlobalScope::setRegistration(WebServiceWorkerRegistration* registration)
+void ServiceWorkerGlobalScope::setRegistration(WebServiceWorkerRegistration* registrationRaw)
{
- if (!executionContext()) {
- ServiceWorkerRegistration::dispose(registration);
+ ASSERT(registrationRaw);
+ OwnPtr<WebServiceWorkerRegistration> registration = adoptPtr(registrationRaw);
+ if (!executionContext())
return;
- }
- m_registration = ServiceWorkerRegistration::from(executionContext(), registration);
+ m_registration = ServiceWorkerRegistration::create(executionContext(), registration.release());
}
bool ServiceWorkerGlobalScope::addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener> listener, bool useCapture)
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerContainer.cpp ('k') | Source/modules/serviceworkers/ServiceWorkerRegistration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698