[webkit-changes] [WebKit/WebKit] 522fb3: ThreadSafeWeakPtr should be able to be safely crea...
Alex Christensen
noreply at github.com
Tue Jun 20 19:41:56 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 522fb3fb9f3b48d6d23181470190a899dd2cf1d0
https://github.com/WebKit/WebKit/commit/522fb3fb9f3b48d6d23181470190a899dd2cf1d0
Author: Alex Christensen <achristensen at apple.com>
Date: 2023-06-20 (Tue, 20 Jun 2023)
Changed paths:
M Source/WTF/wtf/CompactRefPtrTuple.h
M Source/WTF/wtf/HashFunctions.h
M Source/WTF/wtf/HashTraits.h
M Source/WTF/wtf/RefPtr.h
M Source/WTF/wtf/ThreadSafeWeakHashSet.h
M Source/WTF/wtf/ThreadSafeWeakPtr.h
M Source/WebCore/Modules/webaudio/AudioNode.h
M Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUPtr.h
M Source/WebCore/platform/graphics/cairo/RefPtrCairo.cpp
M Source/WebCore/platform/graphics/cairo/RefPtrCairo.h
M Source/WebCore/platform/graphics/freetype/RefPtrFontconfig.cpp
M Source/WebCore/platform/graphics/freetype/RefPtrFontconfig.h
M Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp
Log Message:
-----------
ThreadSafeWeakPtr should be able to be safely created during object destructor
https://bugs.webkit.org/show_bug.cgi?id=258324
Reviewed by Chris Dumez.
This requires a RefPtr to use traits to make it null if weakRef is called after the object's destructor
has been scheduled. Otherwise, we get a non-null RefPtr to the control block.
* Source/WTF/wtf/CompactRefPtrTuple.h:
* Source/WTF/wtf/HashFunctions.h:
* Source/WTF/wtf/HashTraits.h:
(WTF::HashTraits<RefPtr<P>>::emptyValue): Deleted.
(WTF::HashTraits<RefPtr<P>>::peek): Deleted.
(WTF::HashTraits<RefPtr<P>>::customDeleteBucket): Deleted.
* Source/WTF/wtf/RefPtr.h:
(WTF::DefaultRefDerefTraits::refIfNotNull):
(WTF::DefaultRefDerefTraits::derefIfNotNull):
(WTF::RefPtr::RefPtr):
* Source/WTF/wtf/ThreadSafeWeakHashSet.h:
* Source/WTF/wtf/ThreadSafeWeakPtr.h:
(WTF::ThreadSafeWeakPtrControlBlock::weakRef):
(WTF::ThreadSafeWeakPtrControlBlock::weakDeref):
(WTF::ThreadSafeWeakPtrControlBlockRefDerefTraits::refIfNotNull):
(WTF::ThreadSafeWeakPtrControlBlockRefDerefTraits::derefIfNotNull):
(WTF::ThreadSafeWeakPtrControlBlock::ref const): Deleted.
(WTF::ThreadSafeWeakPtrControlBlock::deref const): Deleted.
* Source/WebCore/Modules/webaudio/AudioNode.h:
(WebCore::AudioNodeConnectionRefDerefTraits::refIfNotNull):
(WebCore::AudioNodeConnectionRefDerefTraits::derefIfNotNull):
* Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUPtr.h:
(PAL::WebGPU::release):
* Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp:
(TestWebKitAPI::TEST):
Canonical link: https://commits.webkit.org/265344@main
More information about the webkit-changes
mailing list