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

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

  Log Message:
  -----------
  Ensure usage of TraverseOperation is thread-safe
https://bugs.webkit.org/show_bug.cgi?id=283232
rdar://140041827

Reviewed by Per Arne Vollan and Youenn Fablet.

TraverseOperation is accessed on different threads, see 
Storage::traverseWithinRootPath, but it is not thread-safe.
Its member `type` is a String and is accessed on different threads without 
protection (also it is not an isolated copy).
To fix this issue, this patch just removes the unnecessary data members from 
TraverseOperation, as they can be captured
in WorkQueue task instead. Also, this patch makes TraverseOperation class 
instead of struct, so access to data members
needs to go through member functions, which either have threading check or 
acquire needed lock. Finally, this patch
makes TraverseOperation ThreadSafeRefCounted so it could be captured in task 
instead of data members of Storage.

* Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::~Storage):
(WebKit::NetworkCache::Storage::traverseWithinRootPath):
(WebKit::NetworkCache::Storage::TraverseOperation::TraverseOperation): Deleted.
(WebKit::NetworkCache::Storage::TraverseOperation::WTF_GUARDED_BY_LOCK): 
Deleted.
* Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h:

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