Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 413b6df42e717eff645d3c4ca47a332ddb64edfe
      
https://github.com/WebKit/WebKit/commit/413b6df42e717eff645d3c4ca47a332ddb64edfe
  Author: Youenn Fablet <[email protected]>
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
    M Source/WebCore/Modules/cache/WindowOrWorkerGlobalScopeCaches.cpp
    R Source/WebCore/Modules/cache/WorkerCacheStorageConnection.cpp
    R Source/WebCore/Modules/cache/WorkerCacheStorageConnection.h
    M Source/WebCore/Modules/identity/DigitalCredential.cpp
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/workers/WorkerGlobalScope.cpp
    M Source/WebCore/workers/WorkerGlobalScope.h
    M Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.cpp
    M Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.h
    M Source/WebKit/WebProcess/Cache/WebCacheStorageProvider.cpp

  Log Message:
  -----------
  Do not hit main thread when using CacheStorageConnection from a worker
https://bugs.webkit.org/show_bug.cgi?id=274967
rdar://129062867

Reviewed by Sihui Liu.

We make WebCacheStorageConnection thread safe to be called.
To do so, we add locks for getting the connection and for the hash maps.
To keep consistency between connection and hash maps, as was ensured before 
this patch, we lock both map lock and connection lock when updating the map.

We block the worker thread to get the connection and then we can use it 
directly from the worker.
In case of network process crash, we might have to block again the worker on 
main thread.

Covered by existing tests.

* Source/WebCore/Modules/cache/WindowOrWorkerGlobalScopeCaches.cpp:
* Source/WebCore/Modules/cache/WorkerCacheStorageConnection.cpp: Removed.
* Source/WebCore/Modules/cache/WorkerCacheStorageConnection.h: Removed.
* Source/WebCore/Modules/identity/DigitalCredential.cpp:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::cacheStorageConnection):
* Source/WebCore/workers/WorkerGlobalScope.h:
* Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.cpp:
(WebKit::WebCacheStorageConnection::WebCacheStorageConnection):
(WebKit::WebCacheStorageConnection::~WebCacheStorageConnection):
(WebKit::WebCacheStorageConnection::connection):
(WebKit::WebCacheStorageConnection::open):
(WebKit::WebCacheStorageConnection::remove):
(WebKit::WebCacheStorageConnection::retrieveCaches):
(WebKit::WebCacheStorageConnection::retrieveRecords):
(WebKit::WebCacheStorageConnection::batchDeleteOperation):
(WebKit::WebCacheStorageConnection::batchPutOperation):
(WebKit::WebCacheStorageConnection::reference):
(WebKit::WebCacheStorageConnection::dereference):
(WebKit::WebCacheStorageConnection::lockStorage):
(WebKit::WebCacheStorageConnection::unlockStorage):
(WebKit::WebCacheStorageConnection::clearMemoryRepresentation):
(WebKit::WebCacheStorageConnection::engineRepresentation):
(WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
(WebKit::WebCacheStorageConnection::networkProcessConnectionClosed):
* Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.h:
* Source/WebKit/WebProcess/Cache/WebCacheStorageProvider.cpp:
(WebKit::WebCacheStorageProvider::createCacheStorageConnection):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to