Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b5f740f742198def11e0a98a977a81f56ee057b2
      
https://github.com/WebKit/WebKit/commit/b5f740f742198def11e0a98a977a81f56ee057b2
  Author: Chris Dumez <[email protected]>
  Date:   2026-03-27 (Fri, 27 Mar 2026)

  Changed paths:
    M Source/WTF/wtf/CheckedRef.h

  Log Message:
  -----------
  Remove redundant PtrTraits::unwrap() calls in CheckedRef
https://bugs.webkit.org/show_bug.cgi?id=310852

Reviewed by Ryosuke Niwa.

In the destructor, PtrTraits::exchange() already returned a raw T*, so
calling PtrTraits::unwrap() on it is a no-op for RawPtrTraits and a
wasteful pack-then-unpack round-trip for PackedPtrTraits. The code was
also resetting the pointer to null unnecessarily so I'm actually not
even calling PtrTraits::exchange() anymore. Note that the CheckedPtr
destructor doesn't reset the pointer to null for example.

In the T& constructor, we already have the object reference, so there
is no need to go through m_ptr (which may have just packed the pointer)
only to immediately unpack it.

* Source/WTF/wtf/CheckedRef.h:
(WTF::CheckedRef::~CheckedRef):
(WTF::CheckedRef::CheckedRef):

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



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

Reply via email to