Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 723a649a68dfcb82c8f983012f0c698aaf58756d
      
https://github.com/WebKit/WebKit/commit/723a649a68dfcb82c8f983012f0c698aaf58756d
  Author: Sihui Liu <[email protected]>
  Date:   2024-11-06 (Wed, 06 Nov 2024)

  Changed paths:
    M Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp
    M Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h

  Log Message:
  -----------
  Ensure usage of WriteOperation is thread-safe
https://bugs.webkit.org/show_bug.cgi?id=282631
rdar://139301715

Reviewed by Ben Nham.

NetworkCache::Storage currently accesses WriteOperation on different threads; 
see Storage::dispatchWriteOperation for
an example. However, WriteOperation is not thread-safe: it does not protect its 
members. To fix this issue, this patch
ensures NetworkCache::Storage only accesses WriteOperation on the main thread. 
The background threads gets an isolated
copy of WriteOperation's record and its identifier for performing activities. 
When background threads finish their job,
they pass back the identifier to main thread; then Storage can find the 
WriteOperation by identifier and finish it on
main thread.

* Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::WriteOperation::WriteOperation):
(WebKit::NetworkCache::Storage::WriteOperation::~WriteOperation):
(WebKit::NetworkCache::Storage::WriteOperation::identifier const):
(WebKit::NetworkCache::Storage::WriteOperation::WTF_REQUIRES_CAPABILITY):
(WebKit::NetworkCache::Storage::WriteOperation::invokeMappedBodyHandler):
(WebKit::NetworkCache::Storage::WriteOperation::invokeCompletionHandler):
(WebKit::NetworkCache::Storage::storeBodyAsBlob):
(WebKit::NetworkCache::Storage::removeFromPendingWriteOperations):
(WebKit::NetworkCache::retrieveFromMemory):
(WebKit::NetworkCache::Storage::dispatchWriteOperation):
(WebKit::NetworkCache::Storage::addWriteOperationActivity):
(WebKit::NetworkCache::Storage::removeWriteOperationActivity):
(WebKit::NetworkCache::Storage::finishWriteOperationActivity):
(WebKit::NetworkCache::Storage::retrieve):
(WebKit::NetworkCache::Storage::store):
(WebKit::NetworkCache::Storage::finishWriteOperation): Deleted.
* Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h:
(WebKit::NetworkCache::Storage::Record::isolatedCopy):

Canonical link: https://commits.webkit.org/286261@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