Skip to content

Conversation

youennf
Copy link
Contributor

@youennf youennf commented Mar 2, 2023

6ca935c

Move background fetch quota check to BackgroundFetchStoreManager
https://bugs.webkit.org/show_bug.cgi?id=253234
rdar://problem/106135736

Reviewed by Chris Dumez.

Move the quota check from WebCore/BackgroundFetchEngine to WebKit/BackgroundFetchStoreManager.
We pass down downloadTotal and uploadTotal for that reason.

Resolve the background fetch promise after the quota check and the store operation have been done.
This should solve http/wpt/background-fetch/background-fetch-persistency.window.html flakiness.

* Source/WebCore/workers/service/background-fetch/BackgroundFetch.cpp:
(WebCore::BackgroundFetch::storeResponse):
(WebCore::BackgroundFetch::doStore):
* Source/WebCore/workers/service/background-fetch/BackgroundFetch.h:
* Source/WebCore/workers/service/background-fetch/BackgroundFetchEngine.cpp:
(WebCore::BackgroundFetchEngine::startBackgroundFetch):
* Source/WebCore/workers/service/background-fetch/BackgroundFetchStore.h:
* Source/WebCore/workers/service/server/SWServer.h:
(WebCore::SWServer::createBackgroundFetchRecordLoader):
(WebCore::SWServer::requestBackgroundFetchSpace): Deleted.
* Source/WebCore/workers/service/server/SWServerDelegate.h:
* Source/WebKit/NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::requestBackgroundFetchSpace): Deleted.
* Source/WebKit/NetworkProcess/NetworkSession.h:
* Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreImpl.cpp:
(WebKit::BackgroundFetchStoreImpl::storeFetch):
* Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreImpl.h:
* Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreManager.cpp:
(WebKit::BackgroundFetchStoreManager::BackgroundFetchStoreManager):
(WebKit::BackgroundFetchStoreManager::storeFetch):
(WebKit::BackgroundFetchStoreManager::storeFetchAfterQuotaCheck):
* Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreManager.h:
* Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp:
(WebKit::OriginStorageManager::StorageBucket::backgroundFetchManager):
(WebKit::OriginStorageManager::backgroundFetchManager):

Canonical link: https://commits.webkit.org/261095@main

dc76346

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🛠 gtk
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 🧪 api-mac ✅ 🧪 gtk-wk2
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🧪 api-gtk
✅ 🛠 tv ✅ 🧪 mac-wk2
✅ 🛠 tv-sim ✅ 🧪 mac-AS-debug-wk2
✅ 🛠 watch ✅ 🧪 mac-wk2-stress
✅ 🛠 🧪 merge ✅ 🛠 watch-sim

@youennf youennf requested a review from cdumez as a code owner March 2, 2023 10:58
@youennf youennf self-assigned this Mar 2, 2023
@youennf youennf added the Service Workers Component for Service Workers bugs. label Mar 2, 2023
@youennf youennf force-pushed the eng/Move-background-fetch-quota-check-to-BackgroundFetchStoreManager branch from 300bcd3 to dc76346 Compare March 2, 2023 11:21
Copy link
Contributor

@cdumez cdumez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@youennf youennf added the merge-queue Applied to send a pull request to merge-queue label Mar 2, 2023
https://bugs.webkit.org/show_bug.cgi?id=253234
rdar://problem/106135736

Reviewed by Chris Dumez.

Move the quota check from WebCore/BackgroundFetchEngine to WebKit/BackgroundFetchStoreManager.
We pass down downloadTotal and uploadTotal for that reason.

Resolve the background fetch promise after the quota check and the store operation have been done.
This should solve http/wpt/background-fetch/background-fetch-persistency.window.html flakiness.

* Source/WebCore/workers/service/background-fetch/BackgroundFetch.cpp:
(WebCore::BackgroundFetch::storeResponse):
(WebCore::BackgroundFetch::doStore):
* Source/WebCore/workers/service/background-fetch/BackgroundFetch.h:
* Source/WebCore/workers/service/background-fetch/BackgroundFetchEngine.cpp:
(WebCore::BackgroundFetchEngine::startBackgroundFetch):
* Source/WebCore/workers/service/background-fetch/BackgroundFetchStore.h:
* Source/WebCore/workers/service/server/SWServer.h:
(WebCore::SWServer::createBackgroundFetchRecordLoader):
(WebCore::SWServer::requestBackgroundFetchSpace): Deleted.
* Source/WebCore/workers/service/server/SWServerDelegate.h:
* Source/WebKit/NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::requestBackgroundFetchSpace): Deleted.
* Source/WebKit/NetworkProcess/NetworkSession.h:
* Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreImpl.cpp:
(WebKit::BackgroundFetchStoreImpl::storeFetch):
* Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreImpl.h:
* Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreManager.cpp:
(WebKit::BackgroundFetchStoreManager::BackgroundFetchStoreManager):
(WebKit::BackgroundFetchStoreManager::storeFetch):
(WebKit::BackgroundFetchStoreManager::storeFetchAfterQuotaCheck):
* Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreManager.h:
* Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp:
(WebKit::OriginStorageManager::StorageBucket::backgroundFetchManager):
(WebKit::OriginStorageManager::backgroundFetchManager):

Canonical link: https://commits.webkit.org/261095@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/Move-background-fetch-quota-check-to-BackgroundFetchStoreManager branch from dc76346 to 6ca935c Compare March 2, 2023 21:36
@webkit-early-warning-system webkit-early-warning-system merged commit 6ca935c into WebKit:main Mar 2, 2023
@webkit-commit-queue
Copy link
Collaborator

Committed 261095@main (6ca935c): https://commits.webkit.org/261095@main

Reviewed commits have been landed. Closing PR #10930 and removing active labels.

@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Service Workers Component for Service Workers bugs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants