[webkit-changes] [WebKit/WebKit] 459a04: Preallocate quota for FileSystemSyncAccessHandle

Sihui noreply at github.com
Tue Feb 7 00:52:42 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 459a045d57da232e5149f017fb41038df2a58545
      https://github.com/WebKit/WebKit/commit/459a045d57da232e5149f017fb41038df2a58545
  Author: Sihui Liu <sihui_liu at apple.com>
  Date:   2023-02-07 (Tue, 07 Feb 2023)

  Changed paths:
    M LayoutTests/storage/filesystemaccess/resources/sync-access-handle-storage-limit.js
    M LayoutTests/storage/filesystemaccess/sync-access-handle-storage-limit-worker-expected.txt
    M LayoutTests/storage/filesystemaccess/sync-access-handle-storage-limit-worker.html
    M Source/WebKit/NetworkProcess/storage/FileSystemStorageHandle.cpp
    M Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
    M Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
    M Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
    M Tools/WebKitTestRunner/TestController.cpp
    M Tools/WebKitTestRunner/TestController.h
    M Tools/WebKitTestRunner/TestInvocation.cpp
    M Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
    M Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.h
    M Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm

  Log Message:
  -----------
  Preallocate quota for FileSystemSyncAccessHandle
https://bugs.webkit.org/show_bug.cgi?id=251642
rdar://104980443

Reviewed by Youenn Fablet.

QuotaManager is in network process, and FileSystemSyncAcessHandle performs file operation in web process, so web process
needs to message network process when it needs to use more space. However, FileSystemSyncAccessHandle::write is sync and
supposed to be performant, which means we should unblock them if possible. This patch makes QuotaManager allocate more
capacity to FileSystemSyncAccessHandle than it requests, so that FileSystemSyncAccessHandle would not need to send a
message on each write).

The current allocation policy for requested capacity x is:
1. If x <= 1MB, new capacity is 1MB.
2. If 1MB < x < 256MB, new capacity is 2^(log2(x) + 1).
3. If x >= 256MB, new capacity is (x / 128MB + 1) * 128MB.

With this change, FileSystemSyncAcessHandle tests will start to fail if we disallow quota to increase (e.g. disallow it
to check if quota error can be thrown), because TestRunner sets origin quota to be 40KB by default, and each
FileSystemSyncAcessHandle requests at least 1MB. To fix this, this patch adds a new setQuota() function on TestRunner to
allow configuring quota for each test.

* LayoutTests/storage/filesystemaccess/resources/sync-access-handle-storage-limit.js:
* LayoutTests/storage/filesystemaccess/sync-access-handle-storage-limit-worker-expected.txt:
* LayoutTests/storage/filesystemaccess/sync-access-handle-storage-limit-worker.html:
* Source/WebKit/NetworkProcess/storage/FileSystemStorageHandle.cpp:
(WebKit::FileSystemStorageHandle::requestNewCapacityForSyncAccessHandle):
* Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setQuota):
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.h:
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
(WTR::TestController::setQuota):
* Tools/WebKitTestRunner/TestController.h:
* Tools/WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
* Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::TestController::setQuota):
* Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.h:
* Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm:
(-[TestWebsiteDataStoreDelegate init]):
(-[TestWebsiteDataStoreDelegate requestStorageSpace:frameOrigin:quota:currentSize:spaceRequired:decisionHandler:]):
(-[TestWebsiteDataStoreDelegate setQuota:]):

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




More information about the webkit-changes mailing list