Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8e7db40c161087914e72d6cae6c670525a7373e9
      
https://github.com/WebKit/WebKit/commit/8e7db40c161087914e72d6cae6c670525a7373e9
  Author: Anne van Kesteren <[email protected]>
  Date:   2026-10-07 (Wed, 07 Oct 2026)

  Changed paths:
    M Source/WTF/wtf/WeakPtr.h
    M Source/WTF/wtf/WeakRef.h
    M Source/WebCore/bindings/js/WindowProxy.cpp
    M Source/WebCore/page/PerformanceEventTiming.cpp
    M Source/WebCore/rendering/RenderImageResource.cpp
    M Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp

  Log Message:
  -----------
  WeakPtr and WeakRef downcast() and dynamicDowncast() do not compile
https://bugs.webkit.org/show_bug.cgi?id=326511
rdar://189300330

Reviewed by Chris Dumez.

The WeakPtr and WeakRef overloads of downcast() and dynamicDowncast() added in 
271841@main
cast the WeakPtrImpl rather than the object it refers to, so any use fails to 
compile. Callers
write dynamicDowncast<T>(weakPtr.get()) instead.

For an rvalue, move the WeakPtrImpl into the result after checking the type, 
with a
compile-time check that both types share a WeakValueType. For an lvalue, return 
a raw pointer
or reference, as WeakPtr's downcast() did before 271841@main, so a caller that 
wants a RefPtr
or CheckedPtr doesn't pay for a ref and deref of the WeakPtrImpl.

Drop .get() from callers in WindowProxy, PerformanceEventTiming and 
RenderImageResource, one
for each kind of WeakPtrImpl.

Test: Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp
Canonical link: https://commits.webkit.org/322963@main



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

Reply via email to