[webkit-changes] [WebKit/WebKit] e99488: Make WeakPtr / WeakRef more convenient to use
Chris Dumez
noreply at github.com
Sun Dec 10 09:30:00 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e9948836bf97a6dc9d33ff80eb083b1a17c37e73
https://github.com/WebKit/WebKit/commit/e9948836bf97a6dc9d33ff80eb083b1a17c37e73
Author: Chris Dumez <cdumez at apple.com>
Date: 2023-12-10 (Sun, 10 Dec 2023)
Changed paths:
M Source/WTF/WTF.xcodeproj/project.pbxproj
M Source/WTF/wtf/CMakeLists.txt
M Source/WTF/wtf/CheckedRef.h
A Source/WTF/wtf/SingleThreadIntegralWrapper.h
M Source/WTF/wtf/WeakPtr.h
M Source/WTF/wtf/WeakRef.h
Log Message:
-----------
Make WeakPtr / WeakRef more convenient to use
https://bugs.webkit.org/show_bug.cgi?id=266158
Reviewed by Darin Adler.
Make WeakPtr / WeakRef more convenient to use and more consistent with RefPtr / Ref:
- Add WeakPtr::releaseNonNull() that returns a WeakRef
- Add WeakPtr constructors that that in a `const WeakRef&` / `WeakRef&&`
- Add assignment operators to WeakPtr that in a `const WeakRef&` / `WeakRef&&`
- Have downcast<>() return a WeakPtr / WeakRef when passing in a WeakPtr / WeakRef
- Introduce a dynamicDowncast<>() which works with WeakPtr / WeakRef
* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/CMakeLists.txt:
* Source/WTF/wtf/CheckedRef.h:
(WTF::SingleThreadIntegralWrapper::assertThread const): Deleted.
(WTF::SingleThreadIntegralWrapper<IntegralType>::SingleThreadIntegralWrapper): Deleted.
(WTF::IntegralType const): Deleted.
(WTF::bool const): Deleted.
(WTF::=): Deleted.
(WTF::SingleThreadIntegralWrapper<IntegralType>::operator): Deleted.
* Source/WTF/wtf/SingleThreadIntegralWrapper.h: Added.
(WTF::SingleThreadIntegralWrapper::assertThread const):
(WTF::SingleThreadIntegralWrapper<IntegralType>::SingleThreadIntegralWrapper):
(WTF::IntegralType const):
(WTF::bool const):
(WTF::=):
(WTF::SingleThreadIntegralWrapper<IntegralType>::operator):
* Source/WTF/wtf/WeakPtr.h:
(WTF::WeakPtr::WeakPtr):
(WTF::WeakPtr::releaseImpl):
(WTF::WeakPtr::releaseNonNull):
(WTF::weak_ptr_impl_cast):
(WTF::WeakPtrImpl>::WeakPtr):
(WTF::=):
(WTF::downcast):
(WTF::dynamicDowncast):
(WTF::WeakPtrImplBase::get): Deleted.
(WTF::WeakPtrImplBase::operator bool const): Deleted.
(WTF::WeakPtrImplBase::clear): Deleted.
(WTF::WeakPtrImplBase::wasConstructedOnMainThread const): Deleted.
(WTF::WeakPtrImplBase::WeakPtrImplBase): Deleted.
(WTF::WeakPtrImplBaseSingleThread::get): Deleted.
(WTF::WeakPtrImplBaseSingleThread::operator bool const): Deleted.
(WTF::WeakPtrImplBaseSingleThread::clear): Deleted.
(WTF::WeakPtrImplBaseSingleThread::wasConstructedOnMainThread const): Deleted.
(WTF::WeakPtrImplBaseSingleThread::WeakPtrImplBaseSingleThread): Deleted.
(WTF::WeakPtrImplBaseSingleThread::refCount const): Deleted.
(WTF::WeakPtrImplBaseSingleThread::ref const): Deleted.
(WTF::WeakPtrImplBaseSingleThread::deref const): Deleted.
* Source/WTF/wtf/WeakRef.h:
(WTF::WeakRef::WeakRef):
(WTF::WeakRef::releaseImpl):
(WTF::WeakPtrImplBase::get):
(WTF::WeakPtrImplBase::operator bool const):
(WTF::WeakPtrImplBase::clear):
(WTF::WeakPtrImplBase::wasConstructedOnMainThread const):
(WTF::WeakPtrImplBase::WeakPtrImplBase):
(WTF::WeakPtrImplBaseSingleThread::get):
(WTF::WeakPtrImplBaseSingleThread::operator bool const):
(WTF::WeakPtrImplBaseSingleThread::clear):
(WTF::WeakPtrImplBaseSingleThread::wasConstructedOnMainThread const):
(WTF::WeakPtrImplBaseSingleThread::WeakPtrImplBaseSingleThread):
(WTF::WeakPtrImplBaseSingleThread::refCount const):
(WTF::WeakPtrImplBaseSingleThread::ref const):
(WTF::WeakPtrImplBaseSingleThread::deref const):
(WTF::is):
(WTF::downcast):
(WTF::dynamicDowncast):
Canonical link: https://commits.webkit.org/271841@main
More information about the webkit-changes
mailing list