We no longer need to queue service worker jobs until the connection to the service...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Feb 2018 17:10:18 +0000 (17:10 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Feb 2018 17:10:18 +0000 (17:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182375

Reviewed by Youenn Fablet.

We no longer need to queue service worker jobs until the connection to the service worker process
has been established. We initially did this to work around the fact that registrations restored
from disk would not have an active worker until the service worker process had been established.
However, this issue has been fixed in r227696.

This is basically a revert of r227220, which is no longer needed after r227696.

No new tests, initial fix was covered by an API test that still passes.

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::clearAll):
(WebCore::SWServer::clear):
(WebCore::SWServer::scheduleJob):
(WebCore::SWServer::serverToContextConnectionCreated):
* workers/service/server/SWServer.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227967 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h

index e5a3257..d6225d8 100644 (file)
@@ -1,3 +1,26 @@
+2018-02-01  Chris Dumez  <cdumez@apple.com>
+
+        We no longer need to queue service worker jobs until the connection to the service worker process has been established
+        https://bugs.webkit.org/show_bug.cgi?id=182375
+
+        Reviewed by Youenn Fablet.
+
+        We no longer need to queue service worker jobs until the connection to the service worker process
+        has been established. We initially did this to work around the fact that registrations restored
+        from disk would not have an active worker until the service worker process had been established. 
+        However, this issue has been fixed in r227696.
+
+        This is basically a revert of r227220, which is no longer needed after r227696.
+
+        No new tests, initial fix was covered by an API test that still passes.
+
+        * workers/service/server/SWServer.cpp:
+        (WebCore::SWServer::clearAll):
+        (WebCore::SWServer::clear):
+        (WebCore::SWServer::scheduleJob):
+        (WebCore::SWServer::serverToContextConnectionCreated):
+        * workers/service/server/SWServer.h:
+
 2018-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Shift + mouse scroll should scroll horizontally
index 080cbf8..faac973 100644 (file)
@@ -189,7 +189,6 @@ void SWServer::clearAll(WTF::CompletionHandler<void()>&& completionHandler)
         m_registrations.begin()->value->clear();
     ASSERT(m_registrationsByID.isEmpty());
     m_pendingContextDatas.clear();
-    m_pendingJobs.clear();
     m_originStore->clearAll();
     m_registrationStore.clearAll(WTFMove(completionHandler));
 }
@@ -210,10 +209,6 @@ void SWServer::clear(const SecurityOrigin& origin, WTF::CompletionHandler<void()
         return contextData.registration.key.relatesToOrigin(origin);
     });
 
-    m_pendingJobs.removeAllMatching([&](auto& job) {
-        return job.registrationKey().relatesToOrigin(origin);
-    });
-
     // Calling SWServerRegistration::clear() takes care of updating m_registrations, m_originStore and m_registrationStore.
     for (auto* registration : registrationsToRemove)
         registration->clear();
@@ -269,11 +264,6 @@ void SWServer::scheduleJob(ServiceWorkerJobData&& jobData)
 {
     ASSERT(m_connections.contains(jobData.connectionIdentifier()));
 
-    if (!SWServerToContextConnection::globalServerToContextConnection()) {
-        m_pendingJobs.append(WTFMove(jobData));
-        return;
-    }
-
     // FIXME: Per the spec, check if this job is equivalent to the last job on the queue.
     // If it is, stack it along with that job.
 
@@ -494,10 +484,6 @@ void SWServer::serverToContextConnectionCreated()
         for (auto& callback : item.value)
             callback(success, *connection);
     }
-
-    auto pendingJobs = WTFMove(m_pendingJobs);
-    for (auto& jobData : pendingJobs)
-        scheduleJob(WTFMove(jobData));
 }
 
 void SWServer::installContextData(const ServiceWorkerContextData& data)
index 86bb32c..0052a1f 100644 (file)
@@ -223,7 +223,6 @@ private:
     UniqueRef<SWOriginStore> m_originStore;
     RegistrationStore m_registrationStore;
     Vector<ServiceWorkerContextData> m_pendingContextDatas;
-    Vector<ServiceWorkerJobData> m_pendingJobs;
     HashMap<ServiceWorkerIdentifier, Vector<RunServiceWorkerCallback>> m_serviceWorkerRunRequests;
     PAL::SessionID m_sessionID;
     bool m_importCompleted { false };