Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Firing a fetch event should not be blocked on main thread
https://bugs.webkit.org/show_bug.cgi?id=241096 Patch by Youenn Fablet <youennf@gmail.com> on 2022-06-01 Reviewed by Chris Dumez. The main thread might be blocked by work done by the web page, like executing JavaScript. This might delay fetch events handling. This can cause PLT regressions when serving content through a service worker. To limit the perf penalty, we are now hopping to a work queue to process all WebSWContextManagerConnection messages. For fetch events and message events, we directly go from that thread to the service worker thread. For install/activate/push/notification events, we keep going through the main thread as they are not as perf crtical. Also install/activate should follow the same flow as other events like updatefound which are served through WebSWClientConnection. We change skipWaiting accordingly to remove races in case the reply would go to main thread directly instead of going through the background work queue. We do some refactoring to allow getting a ServiceWorkerThreadProxy from a background queue. * Source/WebCore/workers/service/context/SWContextManager.cpp: (WebCore::SWContextManager::didSaveScriptsToDisk): Deleted. * Source/WebCore/workers/service/context/SWContextManager.h: * Source/WebCore/workers/service/server/SWServerToContextConnection.cpp: (WebCore::SWServerToContextConnection::skipWaiting): Deleted. * Source/WebCore/workers/service/server/SWServerToContextConnection.h: * Source/WebCore/workers/service/server/SWServerWorker.h: * Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::startFetch): (WebCore::ServiceWorkerThreadProxy::convertFetchToDownload): (WebCore::ServiceWorkerThreadProxy::continueDidReceiveFetchResponse): (WebCore::ServiceWorkerThreadProxy::fireMessageEvent): (WebCore::ServiceWorkerThreadProxy::didSaveScriptsToDisk): (WebCore::ServiceWorkerThreadProxy::firePushEvent): (WebCore::ServiceWorkerThreadProxy::firePushSubscriptionChangeEvent): (WebCore::ServiceWorkerThreadProxy::fireNotificationEvent): (WebCore::ServiceWorkerThreadProxy::willPostTaskToFireMessageEvent): Deleted. * Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h: * Source/WebKit/Shared/WebPreferencesStore.h * Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::skipWaiting): * Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::~WebSWContextManagerConnection): (WebKit::WebSWContextManagerConnection::cancelFetch): (WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse): (WebKit::WebSWContextManagerConnection::postMessageToServiceWorker): (WebKit::WebSWContextManagerConnection::didSaveScriptsToDisk): (WebKit::WebSWContextManagerConnection::convertFetchToDownload): (WebKit::WebSWContextManagerConnection::skipWaiting): (WebKit::WebSWContextManagerConnection::skipWaitingCompleted): * Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h: * Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in: Canonical link: https://commits.webkit.org/251183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295088 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
864e6c3
commit 194342e29ed6d5f3cb10ec2ced5ba1d7408a1c68
Showing
19 changed files
with
350 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.