Title: [238908] trunk/Source/WebCore
Revision
238908
Author
[email protected]
Date
2018-12-05 13:35:50 -0800 (Wed, 05 Dec 2018)

Log Message

Update ServiceWorkerContainer::getRegistration lambdas
https://bugs.webkit.org/show_bug.cgi?id=192376

Reviewed by Chris Dumez.

There is no need to pass 'this' in lambdas as the last lambda
takes a ScriptExecutionContext&.
No change of behavior.

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::getRegistration):
(WebCore::ServiceWorkerContainer::getRegistrations):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (238907 => 238908)


--- trunk/Source/WebCore/ChangeLog	2018-12-05 21:15:36 UTC (rev 238907)
+++ trunk/Source/WebCore/ChangeLog	2018-12-05 21:35:50 UTC (rev 238908)
@@ -1,3 +1,18 @@
+2018-12-05  Youenn Fablet  <[email protected]>
+
+        Update ServiceWorkerContainer::getRegistration lambdas
+        https://bugs.webkit.org/show_bug.cgi?id=192376
+
+        Reviewed by Chris Dumez.
+
+        There is no need to pass 'this' in lambdas as the last lambda
+        takes a ScriptExecutionContext&.
+        No change of behavior.
+
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::getRegistration):
+        (WebCore::ServiceWorkerContainer::getRegistrations):
+
 2018-12-05  Chris Dumez  <[email protected]>
 
         Crash under WebCore::cachedDocumentWrapper()

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (238907 => 238908)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2018-12-05 21:15:36 UTC (rev 238907)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2018-12-05 21:35:50 UTC (rev 238908)
@@ -269,10 +269,16 @@
     m_pendingPromises.add(pendingPromiseIdentifier, WTFMove(pendingPromise));
 
     auto contextIdentifier = this->contextIdentifier();
-    callOnMainThread([connection = makeRef(ensureSWClientConnection()), this, topOrigin = context->topOrigin().data().isolatedCopy(), parsedURL = parsedURL.isolatedCopy(), contextIdentifier, pendingPromiseIdentifier]() mutable {
-        connection->matchRegistration(WTFMove(topOrigin), parsedURL, [this, contextIdentifier, pendingPromiseIdentifier] (auto&& result) mutable {
-            ScriptExecutionContext::postTaskTo(contextIdentifier, [this, pendingPromiseIdentifier, result = crossThreadCopy(result)](ScriptExecutionContext&) mutable {
-                this->didFinishGetRegistrationRequest(pendingPromiseIdentifier, WTFMove(result));
+    callOnMainThread([connection = makeRef(ensureSWClientConnection()), topOrigin = context->topOrigin().data().isolatedCopy(), parsedURL = parsedURL.isolatedCopy(), contextIdentifier, pendingPromiseIdentifier]() mutable {
+        connection->matchRegistration(WTFMove(topOrigin), parsedURL, [contextIdentifier, pendingPromiseIdentifier] (auto&& result) mutable {
+            ScriptExecutionContext::postTaskTo(contextIdentifier, [pendingPromiseIdentifier, result = crossThreadCopy(result)](auto& context) mutable {
+                auto* serviceWorkerContainer = context.serviceWorkerContainer();
+                if (!serviceWorkerContainer)
+                    return;
+                if (serviceWorkerContainer->m_isStopped || !context.sessionID().isValid())
+                    return;
+
+                serviceWorkerContainer->didFinishGetRegistrationRequest(pendingPromiseIdentifier, WTFMove(result));
             });
         });
     });
@@ -332,10 +338,16 @@
 
     auto contextIdentifier = this->contextIdentifier();
     auto contextURL = context->url();
-    callOnMainThread([connection = makeRef(ensureSWClientConnection()), this, topOrigin = context->topOrigin().data().isolatedCopy(), contextURL = contextURL.isolatedCopy(), contextIdentifier, pendingPromiseIdentifier]() mutable {
-        connection->getRegistrations(WTFMove(topOrigin), contextURL, [this, contextIdentifier, pendingPromiseIdentifier] (auto&& registrationDatas) mutable {
-            ScriptExecutionContext::postTaskTo(contextIdentifier, [this, pendingPromiseIdentifier, registrationDatas = crossThreadCopy(registrationDatas)](ScriptExecutionContext&) mutable {
-                this->didFinishGetRegistrationsRequest(pendingPromiseIdentifier, WTFMove(registrationDatas));
+    callOnMainThread([connection = makeRef(ensureSWClientConnection()), topOrigin = context->topOrigin().data().isolatedCopy(), contextURL = contextURL.isolatedCopy(), contextIdentifier, pendingPromiseIdentifier]() mutable {
+        connection->getRegistrations(WTFMove(topOrigin), contextURL, [contextIdentifier, pendingPromiseIdentifier] (auto&& registrationDatas) mutable {
+            ScriptExecutionContext::postTaskTo(contextIdentifier, [pendingPromiseIdentifier, registrationDatas = crossThreadCopy(registrationDatas)](auto& context) mutable {
+                auto* serviceWorkerContainer = context.serviceWorkerContainer();
+                if (!serviceWorkerContainer)
+                    return;
+                if (serviceWorkerContainer->m_isStopped || !context.sessionID().isValid())
+                    return;
+
+                serviceWorkerContainer->didFinishGetRegistrationsRequest(pendingPromiseIdentifier, WTFMove(registrationDatas));
             });
         });
     });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to