Skip to content

Commit

Permalink
Simplify RefCounted by removing deleter template argument
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=274246

Reviewed by Chris Dumez and Geoffrey Garen.

Remove the deleter template argument since nobody uses it.
This allows a simpler logic in the clang static analyzer.

* Source/WTF/wtf/RefCounted.h:
(WTF::RefCounted::deref const):
(WTF::RefCounted::derefAllowingPartiallyDestroyed const):

Canonical link: https://commits.webkit.org/278875@main
  • Loading branch information
rniwa committed May 16, 2024
1 parent 4cce2f2 commit 3845f9e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/WTF/wtf/RefCounted.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,19 @@ inline RefCountedBase::~RefCountedBase()
#endif
}

template<typename T, typename Deleter = std::default_delete<T>> class RefCounted : public RefCountedBase {
template<typename T> class RefCounted : public RefCountedBase {
WTF_MAKE_NONCOPYABLE(RefCounted); WTF_MAKE_FAST_ALLOCATED;
public:
void deref() const
{
if (derefBase())
Deleter()(const_cast<T*>(static_cast<const T*>(this)));
delete const_cast<T*>(static_cast<const T*>(this));
}

void derefAllowingPartiallyDestroyed() const
{
if (derefAllowingPartiallyDestroyedBase())
Deleter()(const_cast<T*>(static_cast<const T*>(this)));
delete const_cast<T*>(static_cast<const T*>(this));
}

protected:
Expand Down

0 comments on commit 3845f9e

Please sign in to comment.