Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 55659fc19d4876aefed3818dfb8b231fb0c12edd
      
https://github.com/WebKit/WebKit/commit/55659fc19d4876aefed3818dfb8b231fb0c12edd
  Author: Ryan Reno <rr...@apple.com>
  Date:   2025-07-19 (Sat, 19 Jul 2025)

  Changed paths:
    M Source/WTF/wtf/CompactPtr.h
    M Source/WTF/wtf/ForbidHeapAllocation.h
    M Source/WTF/wtf/KeyValuePair.h
    M Source/WTF/wtf/Ref.h
    M Source/WTF/wtf/RefPtr.h
    M Tools/TestWebKitAPI/Tests/WTF/Lock.cpp

  Log Message:
  -----------
  Prevent heap allocation of Ref and RefPtr but allow placement new of these 
types.
https://bugs.webkit.org/show_bug.cgi?id=296217
rdar://156185263

Reviewed by Simon Fraser.

It doesn't make a lot of sense to heap allocate a Ref or RefPtr directly
such as with auto p = new RefPtr<T>();. So we should no longer fast malloc 
RefPtr.
But we still want to be able to store a Ref or RefPtr in a Vector so let's allow
placement new.

* Source/WTF/wtf/CompactPtr.h:
        Header shuffle.

* Source/WTF/wtf/ForbidHeapAllocation.h:
        Create a variant of WTF_FORBID_HEAP_ALLOCATION which allows
        placement new but disallows the other operator new's.

* Source/WTF/wtf/KeyValuePair.h:
        Header shuffle.

* Source/WTF/wtf/Ref.h:
* Source/WTF/wtf/RefPtr.h:

* Tools/TestWebKitAPI/Tests/WTF/Lock.cpp:
(TestWebKitAPI::runLockTest):
        std::unique_ptr<RefPtr<Thread>[]> is a unique pointer to a dynamically
        sized array of RefPtrs. That's conceptually the same thing as a 
Vector<RefPtr<Thread>>
        so use that instead.

Canonical link: https://commits.webkit.org/297639@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to