Changeset 252300 in webkit
- Timestamp:
- Nov 8, 2019 7:02:59 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252299 r252300 1 2019-11-08 Youenn Fablet <youenn@apple.com> 2 3 SWServerWorker in redundant state do not need to process messages from the context process 4 https://bugs.webkit.org/show_bug.cgi?id=204019 5 6 Reviewed by Chris Dumez. 7 8 When a service worker is marked as redundant in network process, it might still receive some messages like didFinishActivation or didFinishInstall. 9 In that state, we do not need to process these messages. 10 Did some refactoring to directly pass the service worker to the job queue. 11 This makes it clear the registration and service worker are the correct ones. 12 13 * workers/service/server/SWServer.cpp: 14 (WebCore::SWServer::didFinishInstall): 15 Pass the worker instead of its identifier. 16 * workers/service/server/SWServerJobQueue.cpp: 17 (WebCore::SWServerJobQueue::didFinishInstall): 18 Now that we are given the service worker, get its registration directly. 19 * workers/service/server/SWServerJobQueue.h: 20 * workers/service/server/SWServerWorker.cpp: 21 (WebCore::SWServerWorker::didFinishInstall): 22 Exit early in redundant state. 23 (WebCore::SWServerWorker::didFinishActivation): 24 Exit early in redundant state. 25 1 26 2019-11-08 youenn fablet <youenn@apple.com> 2 27 -
trunk/Source/WebCore/workers/service/server/SWServer.cpp
r251409 r252300 446 446 447 447 if (auto* jobQueue = m_jobQueues.get(worker.registrationKey())) 448 jobQueue->didFinishInstall(*jobDataIdentifier, worker .identifier(), wasSuccessful);448 jobQueue->didFinishInstall(*jobDataIdentifier, worker, wasSuccessful); 449 449 } 450 450 -
trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp
r251124 r252300 178 178 179 179 // https://w3c.github.io/ServiceWorker/#install 180 void SWServerJobQueue::didFinishInstall(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, S erviceWorkerIdentifier identifier, bool wasSuccessful)180 void SWServerJobQueue::didFinishInstall(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, SWServerWorker& worker, bool wasSuccessful) 181 181 { 182 182 if (!isCurrentlyProcessingJob(jobDataIdentifier)) 183 183 return; 184 184 185 auto* registration = m_server.getRegistration(m_registrationKey);185 auto* registration = worker.registration(); 186 186 ASSERT(registration); 187 ASSERT(registration->installingWorker()); 188 ASSERT(registration->installingWorker()->identifier() == identifier); 187 ASSERT(registration->installingWorker() == &worker); 189 188 190 189 if (!wasSuccessful) { 191 RefPtr<SWServerWorker> worker = m_server.workerByID(identifier); 192 RELEASE_ASSERT(worker); 193 194 worker->terminate(); 190 worker.terminate(); 195 191 // Run the Update Registration State algorithm passing registration, "installing" and null as the arguments. 196 192 registration->updateRegistrationState(ServiceWorkerRegistrationState::Installing, nullptr); 197 193 // Run the Update Worker State algorithm passing registration's installing worker and redundant as the arguments. 198 registration->updateWorkerState( *worker, ServiceWorkerState::Redundant);194 registration->updateWorkerState(worker, ServiceWorkerState::Redundant); 199 195 200 196 // If newestWorker is null, invoke Clear Registration algorithm passing registration as its argument. … … 212 208 } 213 209 214 auto* installing = registration->installingWorker(); 215 ASSERT(installing); 216 217 registration->updateRegistrationState(ServiceWorkerRegistrationState::Waiting, installing); 210 registration->updateRegistrationState(ServiceWorkerRegistrationState::Waiting, &worker); 218 211 registration->updateRegistrationState(ServiceWorkerRegistrationState::Installing, nullptr); 219 registration->updateWorkerState( *installing, ServiceWorkerState::Installed);212 registration->updateWorkerState(worker, ServiceWorkerState::Installed); 220 213 221 214 finishCurrentJob(); -
trunk/Source/WebCore/workers/service/server/SWServerJobQueue.h
r228101 r252300 35 35 namespace WebCore { 36 36 37 class SWServerWorker; 38 37 39 class SWServerJobQueue { 38 40 WTF_MAKE_FAST_ALLOCATED; … … 52 54 void scriptContextFailedToStart(const ServiceWorkerJobDataIdentifier&, ServiceWorkerIdentifier, const String& message); 53 55 void scriptContextStarted(const ServiceWorkerJobDataIdentifier&, ServiceWorkerIdentifier); 54 void didFinishInstall(const ServiceWorkerJobDataIdentifier&, S erviceWorkerIdentifier, bool wasSuccessful);56 void didFinishInstall(const ServiceWorkerJobDataIdentifier&, SWServerWorker&, bool wasSuccessful); 55 57 void didResolveRegistrationPromise(); 56 58 void cancelJobsFromConnection(SWServerConnectionIdentifier); -
trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp
r250195 r252300 119 119 void SWServerWorker::didFinishInstall(const Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, bool wasSuccessful) 120 120 { 121 ASSERT(m_server); 121 auto state = this->state(); 122 if (state == ServiceWorkerState::Redundant) 123 return; 124 125 ASSERT(m_server); 126 RELEASE_ASSERT(state == ServiceWorkerState::Installing); 122 127 if (m_server) 123 128 m_server->didFinishInstall(jobDataIdentifier, *this, wasSuccessful); … … 126 131 void SWServerWorker::didFinishActivation() 127 132 { 128 ASSERT(m_server); 133 auto state = this->state(); 134 if (state == ServiceWorkerState::Redundant) 135 return; 136 137 ASSERT(m_server); 138 RELEASE_ASSERT(state == ServiceWorkerState::Activating); 129 139 if (m_server) 130 140 m_server->didFinishActivation(*this);
Note: See TracChangeset
for help on using the changeset viewer.