Title: [286359] trunk/Source/WebKit
Revision
286359
Author
you...@apple.com
Date
2021-12-01 04:27:37 -0800 (Wed, 01 Dec 2021)

Log Message

WebSWServerConnection::createFetchTask does not need to query twice for a registration
https://bugs.webkit.org/show_bug.cgi?id=233467

Reviewed by Chris Dumez.

Instead of searching for a worker and then searching for a registration,
we now search for a registration and, if not null, directly get its active worker.
This makes it clear the registration is not null in follow-up code and removes a redundant query.

No change of behavior, this is a refactoring.

* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::createFetchTask):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (286358 => 286359)


--- trunk/Source/WebKit/ChangeLog	2021-12-01 10:56:22 UTC (rev 286358)
+++ trunk/Source/WebKit/ChangeLog	2021-12-01 12:27:37 UTC (rev 286359)
@@ -1,3 +1,19 @@
+2021-12-01  Youenn Fablet  <you...@apple.com>
+
+        WebSWServerConnection::createFetchTask does not need to query twice for a registration
+        https://bugs.webkit.org/show_bug.cgi?id=233467
+
+        Reviewed by Chris Dumez.
+
+        Instead of searching for a worker and then searching for a registration,
+        we now search for a registration and, if not null, directly get its active worker.
+        This makes it clear the registration is not null in follow-up code and removes a redundant query.
+
+        No change of behavior, this is a refactoring.
+
+        * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
+        (WebKit::WebSWServerConnection::createFetchTask):
+
 2021-12-01  Brady Eidson  <beid...@apple.com>
 
         Add WKWebsiteDataStore configuration option to enable Mock app bundle testing.

Modified: trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp (286358 => 286359)


--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp	2021-12-01 10:56:22 UTC (rev 286358)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp	2021-12-01 12:27:37 UTC (rev 286359)
@@ -177,15 +177,15 @@
         serviceWorkerRegistrationIdentifier = *loader.parameters().serviceWorkerRegistrationIdentifier;
     }
 
-    auto* worker = server().activeWorkerFromRegistrationID(*serviceWorkerRegistrationIdentifier);
+    auto* registration = server().getRegistration(*serviceWorkerRegistrationIdentifier);
+    auto* worker = registration ? registration->activeWorker() : nullptr;
     if (!worker) {
         SWSERVERCONNECTION_RELEASE_LOG_ERROR("startFetch: DidNotHandle because no active worker for registration %" PRIu64, serviceWorkerRegistrationIdentifier->toUInt64());
         return nullptr;
     }
 
-    auto* registration = server().getRegistration(*serviceWorkerRegistrationIdentifier);
     if (worker->shouldSkipFetchEvent()) {
-        if (registration && registration->shouldSoftUpdate(loader.parameters().options))
+        if (registration->shouldSoftUpdate(loader.parameters().options))
             registration->scheduleSoftUpdate(loader.isAppInitiated() ? WebCore::IsAppInitiated::Yes : WebCore::IsAppInitiated::No);
 
         return nullptr;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to