Changeset 271404 in webkit
- Timestamp:
- Jan 12, 2021 9:00:21 AM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r271402 r271404 1 2021-01-12 Youenn Fablet <youenn@apple.com> 2 3 Safari Networking high % CPU when Caches/WebKit/ServiceWorkers folder not writable 4 https://bugs.webkit.org/show_bug.cgi?id=220220 5 <rdar://problem/72930195> 6 7 Reviewed by Chris Dumez. 8 9 In case writing changes in the service worker database fails, we retry once. 10 If it fails, we give up and will only retry writing when new changes happen. 11 Manually tested. 12 13 * workers/service/server/RegistrationDatabase.cpp: 14 (WebCore::RegistrationDatabase::pushChanges): 15 (WebCore::RegistrationDatabase::schedulePushChanges): 16 * workers/service/server/RegistrationDatabase.h: 17 1 18 2021-01-12 Philippe Normand <pnormand@igalia.com> 2 19 -
trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp
r265283 r271404 298 298 removedRegistrations.append(keyValue.key.isolatedCopy()); 299 299 } 300 schedulePushChanges(WTFMove(updatedRegistrations), WTFMove(removedRegistrations), WTFMove(completionHandler)); 301 } 302 303 void RegistrationDatabase::schedulePushChanges(Vector<ServiceWorkerContextData>&& updatedRegistrations, Vector<ServiceWorkerRegistrationKey>&& removedRegistrations, CompletionHandler<void()>&& completionHandler) 304 { 305 postTaskToWorkQueue([this, protectedThis = makeRef(*this), pushCounter = m_pushCounter, updatedRegistrations = WTFMove(updatedRegistrations), removedRegistrations = WTFMove(removedRegistrations), completionHandler = WTFMove(completionHandler)]() mutable { 300 schedulePushChanges(WTFMove(updatedRegistrations), WTFMove(removedRegistrations), ShouldRetry::Yes, WTFMove(completionHandler)); 301 } 302 303 void RegistrationDatabase::schedulePushChanges(Vector<ServiceWorkerContextData>&& updatedRegistrations, Vector<ServiceWorkerRegistrationKey>&& removedRegistrations, ShouldRetry shouldRetry, CompletionHandler<void()>&& completionHandler) 304 { 305 auto pushCounter = shouldRetry == ShouldRetry::Yes ? m_pushCounter : 0; 306 postTaskToWorkQueue([this, protectedThis = makeRef(*this), pushCounter, updatedRegistrations = WTFMove(updatedRegistrations), removedRegistrations = WTFMove(removedRegistrations), completionHandler = WTFMove(completionHandler)]() mutable { 306 307 bool success = doPushChanges(updatedRegistrations, removedRegistrations); 307 308 if (success) { … … 311 312 callOnMainThread([this, protectedThis = WTFMove(protectedThis), success, pushCounter, updatedRegistrations = WTFMove(updatedRegistrations).isolatedCopy(), removedRegistrations = WTFMove(removedRegistrations).isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable { 312 313 if (!success && (pushCounter + 1) == m_pushCounter) { 313 // We retry writing if no other change was pushed.314 schedulePushChanges(WTFMove(updatedRegistrations), WTFMove(removedRegistrations), WTFMove(completionHandler));314 // We retry writing once if no other change was pushed. 315 schedulePushChanges(WTFMove(updatedRegistrations), WTFMove(removedRegistrations), ShouldRetry::No, WTFMove(completionHandler)); 315 316 return; 316 317 } -
trunk/Source/WebCore/workers/service/server/RegistrationDatabase.h
r265283 r271404 62 62 String databaseDirectoryIsolatedCopy() const { return m_databaseDirectory.isolatedCopy(); } 63 63 64 void schedulePushChanges(Vector<ServiceWorkerContextData>&&, Vector<ServiceWorkerRegistrationKey>&&, CompletionHandler<void()>&&); 64 enum class ShouldRetry { No, Yes }; 65 void schedulePushChanges(Vector<ServiceWorkerContextData>&&, Vector<ServiceWorkerRegistrationKey>&&, ShouldRetry, CompletionHandler<void()>&&); 65 66 void postTaskToWorkQueue(Function<void()>&&); 66 67
Note: See TracChangeset
for help on using the changeset viewer.