You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1ace22c
Browse filesBrowse the repository at this point in the historyBrowse files
Allow casting a std::unique_ptr or UniqueRef without calling get()
https://bugs.webkit.org/show_bug.cgi?id=327673
rdar://190102641
Reviewed by Chris Dumez.
Casting a RefPtr, Ref, WeakPtr, WeakRef, CheckedPtr, or CheckedRef lvalue returns what casting
its get() returns, but std::unique_ptr and UniqueRef only had is<>(), so their callers still
write dynamicDowncast<T>(m_context.get()).
Add the same downcast<>(), dynamicDowncast<>(), and uncheckedDowncast<>() overloads for a
std::unique_ptr lvalue, which return a pointer, and for a UniqueRef lvalue, where downcast<>()
and uncheckedDowncast<>() return a reference. The cast result doesn't own the object, so the
rvalue overloads are deleted rather than letting a temporary bind to the const reference ones.
Drop get() from the casts in HTMLCanvasElement and WorkerOrWorkletThread, and let
readability/redundant_get flag get() on a std::unique_ptr or UniqueRef passed to these casts.
Test: Tools/TestWebKitAPI/Tests/WTF/UniqueRef.cpp
Canonical link: https://commits.webkit.org/323824@main
0 commit comments