Implement "UpdateWorkerState" and use it
[WebKit-https.git] / Source / WebCore / workers / service / server / SWClientConnection.cpp
index 6e30c32..d9341b8 100644 (file)
@@ -150,10 +150,18 @@ void SWClientConnection::forEachContainer(const WTF::Function<void(ServiceWorker
 void SWClientConnection::updateRegistrationState(const ServiceWorkerRegistrationKey& key, ServiceWorkerRegistrationState state, std::optional<ServiceWorkerIdentifier> serviceWorkerIdentifier)
 {
     forEachContainer([&](ServiceWorkerContainer& container) {
-        container.updateRegistration(key, state, serviceWorkerIdentifier);
+        container.updateRegistrationState(key, state, serviceWorkerIdentifier);
     });
 }
 
+void SWClientConnection::updateWorkerState(ServiceWorkerIdentifier worker, ServiceWorkerState state)
+{
+    const auto& matchingWorkers = ServiceWorker::allWorkers().get(worker);
+    
+    for (auto* worker : matchingWorkers)
+        worker->updateWorkerState(state);
+}
+
 void SWClientConnection::fireUpdateFoundEvent(const ServiceWorkerRegistrationKey& key)
 {
     forEachContainer([&](ServiceWorkerContainer& container) {