-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move service worker registration and worker state updates out of main thread for service worker contexts #2115
Open
youennf
wants to merge
1
commit into
WebKit:main
Choose a base branch
from
youennf:eng/Move-service-worker-registration-and-worker-state-updates-out-of-main-thread-for-service-worker-contexts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
… thread for service worker contexts https://bugs.webkit.org/show_bug.cgi?id=242383 rdar://problem/96510954 Reviewed by NOBODY (OOPS!). We are now handling some of the IPC message going to service workers on a background queue. Some other messages to service workers are going through main thread as they are WebSWClientConnection messages. This includes worker/registration state updates. To make things more tight, we are now handling WebSWClientConnection messages on the same queue as WebSWContextManagerConnection. When messages are to be sent to service workers, we directly hop to the service worker thread. This allows the service worker messages to use the same path in WebSWClientConnection and WebSWContextManagerConnection. For WebSWClientConnection messages that require getting to other workers or documents, we keep hopping to main thread. Minor drive-by fix to make sure to call the completion handler in SWContextManager::fireNotificationEvent in case the worker is not there. Changes are covered by existing tests. * Source/WebCore/workers/Worker.cpp: * Source/WebCore/workers/service/SWClientConnection.cpp: (WebCore::SWClientConnection::jobRejectedInServer): (WebCore::SWClientConnection::registrationJobResolvedInServer): (WebCore::SWClientConnection::startScriptFetchForServer): (WebCore::SWClientConnection::refreshImportedScripts): (WebCore::SWClientConnection::postMessageToServiceWorkerClient): (WebCore::forAllDedicatedAndSharedWorkers): (WebCore::doUpdateRegistrationState): (WebCore::SWClientConnection::updateRegistrationState): (WebCore::doUpdateWorkerState): (WebCore::SWClientConnection::updateWorkerState): (WebCore::doFireUpdateFoundEvent): (WebCore::SWClientConnection::fireUpdateFoundEvent): (WebCore::doSetRegistrationLastUpdateTime): (WebCore::SWClientConnection::setRegistrationLastUpdateTime): (WebCore::doSetRegistrationUpdateViaCache): (WebCore::SWClientConnection::setRegistrationUpdateViaCache): (WebCore::SWClientConnection::notifyClientsOfControllerChange): (WebCore::SWClientConnection::registerServiceWorkerClients): (WebCore::forAllWorkers): Deleted. * Source/WebCore/workers/service/SWClientConnection.h: * Source/WebCore/workers/service/ServiceWorkerRegistrationData.h: * Source/WebCore/workers/service/WorkerSWClientConnection.h: * Source/WebCore/workers/service/context/SWContextManager.cpp: (WebCore::SWContextManager::fireNotificationEvent): (WebCore::SWContextManager::fireInstallEvent): Deleted. (WebCore::SWContextManager::fireActivateEvent): Deleted. * Source/WebCore/workers/service/context/SWContextManager.h: * Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::dispatchFetchEvent): * Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::fireInstallEvent): (WebCore::ServiceWorkerThreadProxy::fireActivateEvent): * Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h: * Source/WebCore/workers/shared/context/SharedWorkerContextManager.cpp: * Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::didReceiveMessage): (WebKit::NetworkProcessConnection::didReceiveSyncMessage): (WebKit::NetworkProcessConnection::serviceWorkerConnection): * Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::~WebSWClientConnection): (WebKit::WebSWClientConnection::establishConnection): (WebKit::WebSWClientConnection::closeConnection): (WebKit::WebSWClientConnection::messageSenderConnection const): (WebKit::WebSWClientConnection::scheduleJobInServer): (WebKit::WebSWClientConnection::finishFetchingScriptInServer): (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer): (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer): (WebKit::WebSWClientConnection::scheduleUnregisterJobInServer): (WebKit::WebSWClientConnection::mayHaveServiceWorkerRegisteredForOrigin const): (WebKit::WebSWClientConnection::setSWOriginTableSharedMemory): (WebKit::WebSWClientConnection::setSWOriginTableIsImported): (WebKit::WebSWClientConnection::runOrDelayTaskForImport): (WebKit::WebSWClientConnection::whenRegistrationReady): (WebKit::WebSWClientConnection::setServiceWorkerClientIsControlled): (WebKit::WebSWClientConnection::connectionToServerLost): (WebKit::WebSWClientConnection::clear): (WebKit::WebSWClientConnection::terminateWorkerForTesting): (WebKit::WebSWClientConnection::whenServiceWorkerIsTerminatedForTesting): (WebKit::WebSWClientConnection::updateThrottleState): (WebKit::WebSWClientConnection::storeRegistrationsOnDiskForTesting): (WebKit::WebSWClientConnection::subscribeToPushService): (WebKit::WebSWClientConnection::unsubscribeFromPushService): (WebKit::WebSWClientConnection::getPushSubscription): (WebKit::WebSWClientConnection::getPushPermissionState): (WebKit::WebSWClientConnection::getNotifications): (WebKit::WebSWClientConnection::enableNavigationPreload): (WebKit::WebSWClientConnection::disableNavigationPreload): (WebKit::WebSWClientConnection::setNavigationPreloadHeaderValue): (WebKit::WebSWClientConnection::getNavigationPreloadState): (WebKit::WebSWClientConnection::focusServiceWorkerClient): (WebKit::WebSWClientConnection::refreshImportedScripts): * Source/WebKit/WebProcess/Storage/WebSWClientConnection.h: * Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::sharedQueue): (WebKit::m_userContentController): (WebKit::WebSWContextManagerConnection::establishConnection): (WebKit::WebSWContextManagerConnection::installServiceWorker): (WebKit::WebSWContextManagerConnection::cancelFetch): (WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse): (WebKit::WebSWContextManagerConnection::startFetch): (WebKit::WebSWContextManagerConnection::postMessageToServiceWorker): (WebKit::WebSWContextManagerConnection::fireInstallEvent): (WebKit::WebSWContextManagerConnection::fireActivateEvent): (WebKit::WebSWContextManagerConnection::firePushEvent): (WebKit::WebSWContextManagerConnection::fireNotificationEvent): (WebKit::WebSWContextManagerConnection::terminateWorker): (WebKit::WebSWContextManagerConnection::didSaveScriptsToDisk): (WebKit::WebSWContextManagerConnection::convertFetchToDownload): (WebKit::WebSWContextManagerConnection::navigationPreloadIsReady): (WebKit::WebSWContextManagerConnection::navigationPreloadFailed): (WebKit::WebSWContextManagerConnection::skipWaitingCompleted): (WebKit::WebSWContextManagerConnection::matchAllCompleted): (WebKit::WebSWContextManagerConnection::setThrottleState): (WebKit::m_queue): Deleted. * Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h: * Source/WebKit/WebProcess/WebProcess.cpp: (WebKit::WebProcess::ensureNetworkProcessConnection):
youennf
added
Service Workers
Component for Service Workers bugs.
WebKit Nightly Build
labels
Jul 6, 2022
webkit-early-warning-system
added
the
merging-blocked
Applied to prevent a change from being merged
label
Jul 6, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
merging-blocked
Applied to prevent a change from being merged
Service Workers
Component for Service Workers bugs.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
9e9572d