Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f8a1a8119a8ecf6eec0d46260f5f0c8a6603e0f7
      
https://github.com/WebKit/WebKit/commit/f8a1a8119a8ecf6eec0d46260f5f0c8a6603e0f7
  Author: Geoffrey Garen <[email protected]>
  Date:   2025-12-01 (Mon, 01 Dec 2025)

  Changed paths:
    M Source/WTF/wtf/HashTable.h
    M Source/WTF/wtf/WeakHashSet.h
    M Source/WTF/wtf/WeakPtr.h
    M Source/WTF/wtf/WeakPtrFactory.h
    M Source/WebCore/dom/TreeScope.cpp

  Log Message:
  -----------
  Use WeakPtr in WeakHashSet
https://bugs.webkit.org/show_bug.cgi?id=303247
<rdar://problem/165538736>

Reviewed by Darin Adler.

This removes the need for WeakHashSet to be a friend to WeakPtr
and WeakPtrFactory.

This is also a step toward a more efficient WeakPtr.

I added a null key check to the HashTable consistency check because a WeakPtr<T>
key can become null during normal operation. It's impossible for a valid key
lookup to find the null, but manual bucket iteration, as in the HashTable
consistency check, will find it.

I amended WeakPtr hash traits to make sure not to instantiate a WeakPtr when
checking for the empty and deleted values. This is a small optimization and
it's required to pass API Tests.

* Source/WTF/wtf/HashTable.h:
(WTF::Malloc>::checkTableConsistencyExceptSize const):
* Source/WTF/wtf/WeakHashSet.h:
(WTF::containerSize):
(WTF::copyToVector):
* Source/WTF/wtf/WeakPtr.h:
(WTF::WeakPtrHashTraits::isEmptyValue):
(WTF::WeakPtrHashTraits::isDeletedValue):
* Source/WTF/wtf/WeakPtrFactory.h:
* Source/WebCore/dom/TreeScope.cpp:
(WebCore::TreeScope::isElementWithPendingSVGResources const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to