WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-204019-20191108140116.patch (text/plain), 7.55 KB, created by
youenn fablet
on 2019-11-08 14:01:16 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-11-08 14:01:16 PST
Size:
7.55 KB
patch
obsolete
>Subversion Revision: 252178 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 588aaf82bd16f2b2ce5e7683561d40f2bfeef0a9..98ea5224004901af9ca05ff96477990f6b2154ca 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,28 @@ >+2019-11-08 Youenn Fablet <youenn@apple.com> >+ >+ SWServerWorker in redundant state do not need to process messages from the context process >+ https://bugs.webkit.org/show_bug.cgi?id=204019 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When a service worker is marked as redundant in network process, it might still receive some messages like didFinishActivation or didFinishInstall. >+ In that state, we do not need to process these messages. >+ Did some refactoring to directly pass the service worker to the job queue. >+ This makes it clear the registration and service worker are the correct ones. >+ >+ * workers/service/server/SWServer.cpp: >+ (WebCore::SWServer::didFinishInstall): >+ Pass the worker instead of its identifier. >+ * workers/service/server/SWServerJobQueue.cpp: >+ (WebCore::SWServerJobQueue::didFinishInstall): >+ Now that we are given the service worker, get its registration directly. >+ * workers/service/server/SWServerJobQueue.h: >+ * workers/service/server/SWServerWorker.cpp: >+ (WebCore::SWServerWorker::didFinishInstall): >+ Exit early in redundant state. >+ (WebCore::SWServerWorker::didFinishActivation): >+ Exit early in redundant state. >+ > 2019-11-07 Youenn Fablet <youenn@apple.com> > > Update libwebrtc to M78 >diff --git a/Source/WebCore/workers/service/server/SWServer.cpp b/Source/WebCore/workers/service/server/SWServer.cpp >index dbe9a3027c3946cfbb3116e88116f7c9037b5429..c764baa99e73e7dfaf3181751d5589d57d62bf09 100644 >--- a/Source/WebCore/workers/service/server/SWServer.cpp >+++ b/Source/WebCore/workers/service/server/SWServer.cpp >@@ -445,7 +445,7 @@ void SWServer::didFinishInstall(const Optional<ServiceWorkerJobDataIdentifier>& > RELEASE_LOG_ERROR(ServiceWorker, "%p - SWServer::didFinishInstall: Failed SW install for job %s", this, jobDataIdentifier->loggingString().utf8().data()); > > if (auto* jobQueue = m_jobQueues.get(worker.registrationKey())) >- jobQueue->didFinishInstall(*jobDataIdentifier, worker.identifier(), wasSuccessful); >+ jobQueue->didFinishInstall(*jobDataIdentifier, worker, wasSuccessful); > } > > void SWServer::didFinishActivation(SWServerWorker& worker) >diff --git a/Source/WebCore/workers/service/server/SWServerJobQueue.cpp b/Source/WebCore/workers/service/server/SWServerJobQueue.cpp >index 6d7cda05ff792668914ae8c4dcbf70ad39e88927..487cc75d5f3e6288f9fccf0b68dd5260982cacdb 100644 >--- a/Source/WebCore/workers/service/server/SWServerJobQueue.cpp >+++ b/Source/WebCore/workers/service/server/SWServerJobQueue.cpp >@@ -177,25 +177,21 @@ void SWServerJobQueue::didResolveRegistrationPromise() > } > > // https://w3c.github.io/ServiceWorker/#install >-void SWServerJobQueue::didFinishInstall(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, ServiceWorkerIdentifier identifier, bool wasSuccessful) >+void SWServerJobQueue::didFinishInstall(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, SWServerWorker& worker, bool wasSuccessful) > { > if (!isCurrentlyProcessingJob(jobDataIdentifier)) > return; > >- auto* registration = m_server.getRegistration(m_registrationKey); >+ auto* registration = worker.registration(); > ASSERT(registration); >- ASSERT(registration->installingWorker()); >- ASSERT(registration->installingWorker()->identifier() == identifier); >+ ASSERT(registration->installingWorker() == &worker); > > if (!wasSuccessful) { >- RefPtr<SWServerWorker> worker = m_server.workerByID(identifier); >- RELEASE_ASSERT(worker); >- >- worker->terminate(); >+ worker.terminate(); > // Run the Update Registration State algorithm passing registration, "installing" and null as the arguments. > registration->updateRegistrationState(ServiceWorkerRegistrationState::Installing, nullptr); > // Run the Update Worker State algorithm passing registration's installing worker and redundant as the arguments. >- registration->updateWorkerState(*worker, ServiceWorkerState::Redundant); >+ registration->updateWorkerState(worker, ServiceWorkerState::Redundant); > > // If newestWorker is null, invoke Clear Registration algorithm passing registration as its argument. > if (!registration->getNewestWorker()) >@@ -211,12 +207,9 @@ void SWServerJobQueue::didFinishInstall(const ServiceWorkerJobDataIdentifier& jo > registration->updateWorkerState(*waitingWorker, ServiceWorkerState::Redundant); > } > >- auto* installing = registration->installingWorker(); >- ASSERT(installing); >- >- registration->updateRegistrationState(ServiceWorkerRegistrationState::Waiting, installing); >+ registration->updateRegistrationState(ServiceWorkerRegistrationState::Waiting, &worker); > registration->updateRegistrationState(ServiceWorkerRegistrationState::Installing, nullptr); >- registration->updateWorkerState(*installing, ServiceWorkerState::Installed); >+ registration->updateWorkerState(worker, ServiceWorkerState::Installed); > > finishCurrentJob(); > >diff --git a/Source/WebCore/workers/service/server/SWServerJobQueue.h b/Source/WebCore/workers/service/server/SWServerJobQueue.h >index 75a0cbd83934959146d85beefff877f87cc45b17..0a9777ebb90cd0184aca0e7f5f57b26d0ad0d1c0 100644 >--- a/Source/WebCore/workers/service/server/SWServerJobQueue.h >+++ b/Source/WebCore/workers/service/server/SWServerJobQueue.h >@@ -34,6 +34,8 @@ > > namespace WebCore { > >+class SWServerWorker; >+ > class SWServerJobQueue { > WTF_MAKE_FAST_ALLOCATED; > public: >@@ -51,7 +53,7 @@ public: > void scriptFetchFinished(SWServer::Connection&, const ServiceWorkerFetchResult&); > void scriptContextFailedToStart(const ServiceWorkerJobDataIdentifier&, ServiceWorkerIdentifier, const String& message); > void scriptContextStarted(const ServiceWorkerJobDataIdentifier&, ServiceWorkerIdentifier); >- void didFinishInstall(const ServiceWorkerJobDataIdentifier&, ServiceWorkerIdentifier, bool wasSuccessful); >+ void didFinishInstall(const ServiceWorkerJobDataIdentifier&, SWServerWorker&, bool wasSuccessful); > void didResolveRegistrationPromise(); > void cancelJobsFromConnection(SWServerConnectionIdentifier); > void cancelJobsFromServiceWorker(ServiceWorkerIdentifier); >diff --git a/Source/WebCore/workers/service/server/SWServerWorker.cpp b/Source/WebCore/workers/service/server/SWServerWorker.cpp >index 37e5700bcdf1527ecf43d39940563d5f334687cf..655d70d2fcfeddcaa2482c7b5aac02ff0cea97ae 100644 >--- a/Source/WebCore/workers/service/server/SWServerWorker.cpp >+++ b/Source/WebCore/workers/service/server/SWServerWorker.cpp >@@ -118,14 +118,24 @@ void SWServerWorker::scriptContextStarted(const Optional<ServiceWorkerJobDataIde > > void SWServerWorker::didFinishInstall(const Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, bool wasSuccessful) > { >+ auto state = this->state(); >+ if (state == ServiceWorkerState::Redundant) >+ return; >+ > ASSERT(m_server); >+ RELEASE_ASSERT(state == ServiceWorkerState::Installing); > if (m_server) > m_server->didFinishInstall(jobDataIdentifier, *this, wasSuccessful); > } > > void SWServerWorker::didFinishActivation() > { >+ auto state = this->state(); >+ if (state == ServiceWorkerState::Redundant) >+ return; >+ > ASSERT(m_server); >+ RELEASE_ASSERT(state == ServiceWorkerState::Activating); > if (m_server) > m_server->didFinishActivation(*this); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 204019
: 383161