Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 58e8ab36fc7d9b1cb93e6d8b49668546679f5e6a
      
https://github.com/WebKit/WebKit/commit/58e8ab36fc7d9b1cb93e6d8b49668546679f5e6a
  Author: Ryosuke Niwa <rn...@webkit.org>
  Date:   2023-01-24 (Tue, 24 Jan 2023)

  Changed paths:
    M Source/WTF/wtf/WeakHashMap.h
    M Source/WTF/wtf/WeakHashSet.h
    M Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp

  Log Message:
  -----------
  Amortized behaviors of iterators and hasNullReferences should be consistent 
between WeakHashSet and WeakHashMap
https://bugs.webkit.org/show_bug.cgi?id=251116

Reviewed by Chris Dumez.

Made const_iterator and hasNullReferences of WeakHashSet trigger amortized 
cleanup as in WeakHashMap for consistency.

* Source/WTF/wtf/WeakHashMap.h:
(WeakHashMap::hasNullReferences): Just increment the operation count and don't 
do amortized cleanup here.

* Source/WTF/wtf/WeakHashSet.h:
(WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator):
(WeakHashSet::WeakHashSetConstIterator::operator++): Increment the operation 
count.
(WeakHashSet::begin):
(WeakHashSet::end):
(WeakHashSet::hasNullReferences): Increase the operation count.
(WeakHashSet::forEach): Don't increment the operation count here given the 
iterator does it now.
(WeakHashSet::increaseOperationCountSinceLastCleanup): Now takes the increment 
as an argument.

* Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp:
(WTF_WeakPtr.WeakHashSetAmortizedCleanup): Added.
(WTF_WeakPtr.WeakHashMapAmortizedCleanup):

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to