[webkit-changes] [WebKit/WebKit] e9a1f7: Allow setting a storage limit for all origins

Sihui noreply at github.com
Tue Mar 28 00:10:34 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e9a1f73b15efbe97e1d3a5ea7a5d211c616215a9
      https://github.com/WebKit/WebKit/commit/e9a1f73b15efbe97e1d3a5ea7a5d211c616215a9
  Author: Sihui Liu <sihui_liu at apple.com>
  Date:   2023-03-28 (Tue, 28 Mar 2023)

  Changed paths:
    M Source/WebKit/NetworkProcess/NetworkSession.cpp
    M Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp
    M Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h
    A Source/WebKit/NetworkProcess/storage/NetworkQuotaManager.cpp
    A Source/WebKit/NetworkProcess/storage/NetworkQuotaManager.h
    M Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp
    M Source/WebKit/NetworkProcess/storage/NetworkStorageManager.h
    A Source/WebKit/NetworkProcess/storage/OriginQuotaManager.cpp
    A Source/WebKit/NetworkProcess/storage/OriginQuotaManager.h
    M Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp
    M Source/WebKit/NetworkProcess/storage/OriginStorageManager.h
    R Source/WebKit/NetworkProcess/storage/QuotaManager.cpp
    R Source/WebKit/NetworkProcess/storage/QuotaManager.h
    M Source/WebKit/Platform/IPC/WorkQueueMessageReceiver.h
    M Source/WebKit/Sources.txt
    M Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h
    M Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm

  Log Message:
  -----------
  Allow setting a storage limit for all origins
https://bugs.webkit.org/show_bug.cgi?id=254011
rdar://106792298

Reviewed by Youenn Fablet.

Make it possible to set a total quota of all origins based on disk space. This is implemented by adding a setting
totalQuotaRatio to WebsiteDataStoreConfiguration. The overall quota of a data store is calculated by:
totalDiskSpace * totalQuotaRatio. When this quota is exceeded, network process will evict data (only for data types that
are managed by NetworkStorageManager) based on LRU policy.

Test: WKWebsiteDataStoreConfiguration.TotalQuotaRatio

* Source/WebKit/NetworkProcess/NetworkSession.cpp:
(WebKit::createNetworkStorageManager):
* Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h:
* Source/WebKit/NetworkProcess/storage/NetworkQuotaManager.cpp: Added.
(WebKit::NetworkQuotaManager::NetworkQuotaManager):
(WebKit::NetworkQuotaManager::originUsageUpdated):
(WebKit::NetworkQuotaManager::performEvictionIfNeeded):
(WebKit::NetworkQuotaManager::originVisited):
* Source/WebKit/NetworkProcess/storage/NetworkQuotaManager.h: Copied from Source/WebKit/Platform/IPC/WorkQueueMessageReceiver.h.
* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::create):
(WebKit::NetworkStorageManager::NetworkStorageManager):
(WebKit::NetworkStorageManager::canHandleTypes):
(WebKit::NetworkStorageManager::allManagedTypes):
(WebKit::NetworkStorageManager::stopReceivingMessageFromConnection):
(WebKit::NetworkStorageManager::writeOriginToFileIfNecessary):
(WebKit::NetworkStorageManager::quotaManager):
(WebKit::NetworkStorageManager::originStorageManager):
(WebKit::NetworkStorageManager::removeOriginStorageManagerIfPossible):
(WebKit::NetworkStorageManager::updateOriginModificationTime):
(WebKit::NetworkStorageManager::evictDataByTopOrigin):
(WebKit::NetworkStorageManager::getOriginDirectory):
(WebKit::NetworkStorageManager::requestSpace):
* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.h:
* Source/WebKit/NetworkProcess/storage/OriginQuotaManager.cpp: Renamed from Source/WebKit/NetworkProcess/storage/QuotaManager.cpp.
(WebKit::OriginQuotaManager::create):
(WebKit::OriginQuotaManager::OriginQuotaManager):
(WebKit::OriginQuotaManager::usage):
(WebKit::OriginQuotaManager::requestSpace):
(WebKit::OriginQuotaManager::handleRequests):
(WebKit::OriginQuotaManager::grantWithCurrentQuota):
(WebKit::OriginQuotaManager::usageUpdated):
(WebKit::OriginQuotaManager::grantFastPath):
(WebKit::OriginQuotaManager::didIncreaseQuota):
(WebKit::OriginQuotaManager::resetQuotaUpdatedBasedOnUsageForTesting):
(WebKit::OriginQuotaManager::resetQuotaForTesting):
(WebKit::OriginQuotaManager::reportedQuota const):
* Source/WebKit/NetworkProcess/storage/OriginQuotaManager.h: Renamed from Source/WebKit/NetworkProcess/storage/QuotaManager.h.
(WebKit::OriginQuotaManager::create):
* Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp:
(WebKit::OriginStorageManager::StorageBucket::isActive const):
(WebKit::OriginStorageManager::StorageBucket::hasDataInMemory const):
(WebKit::OriginStorageManager::createQuotaManager):
(WebKit::OriginStorageManager::OriginStorageManager):
(WebKit::OriginStorageManager::quotaManager):
(WebKit::OriginStorageManager::fileSystemStorageManager):
(WebKit::OriginStorageManager::idbStorageManager):
(WebKit::OriginStorageManager::cacheStorageManager):
(WebKit::OriginStorageManager::backgroundFetchManager):
(WebKit::OriginStorageManager::hasDataInMemory):
* Source/WebKit/NetworkProcess/storage/OriginStorageManager.h:
* Source/WebKit/Platform/IPC/WorkQueueMessageReceiver.h:
* Source/WebKit/Sources.txt:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration totalQuotaRatio]):
(-[_WKWebsiteDataStoreConfiguration setTotalQuotaRatio:]):
(-[_WKWebsiteDataStoreConfiguration volumeCapacityOverride]):
(-[_WKWebsiteDataStoreConfiguration setVolumeCapacityOverride:]):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::copy const):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::totalQuotaRatio const):
(WebKit::WebsiteDataStoreConfiguration::setTotalQuotaRatio):
(WebKit::WebsiteDataStoreConfiguration::volumeCapacityOverride const):
(WebKit::WebsiteDataStoreConfiguration::setVolumeCapacityOverride):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list