[webkit-changes] [WebKit/WebKit] 36514d: Some RetainPtr cleanup [v2]

geoffreygaren noreply at github.com
Sat Feb 22 17:40:14 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 36514def01eb1550439a9edf6651654ca8967be6
      https://github.com/WebKit/WebKit/commit/36514def01eb1550439a9edf6651654ca8967be6
  Author: Geoffrey Garen <ggaren at apple.com>
  Date:   2025-02-22 (Sat, 22 Feb 2025)

  Changed paths:
    M Source/WTF/wtf/RetainPtr.h

  Log Message:
  -----------
  Some RetainPtr cleanup [v2]
https://bugs.webkit.org/show_bug.cgi?id=288291
rdar://145371975

Reviewed by Timothy Hatcher.

Fixed a series of bugs where is_convertible_v tests attempting to distinguish id
from CFTypeRef were incorrect because they were testing e.g. NSString == id
instead of NSString* == id.

Added a helper for IsNSType, to simplify is_convertible_v tests.

Tightened type requirements so that e.g. RetainPtr<NSString> is supported but
RetainPtr<NSString*> is not.

Renamed HelperPtrType to RetainPtrType and pulled it outside the class for
clarity. The old model of RetainPtr<NSString*>::HelperPtrType == NSString was a
bit mind-bending because
    * RetainPtr<NSString*> is malformed
    * NSString is not a pointer type

Added #defines for CF_RETURNS_RETAINED and NS_RETURNS_RETAINED, to
reduce #ifdefs inside the class.

Removed support for ObjC GC because it's the year 2025 and the future is now.

* Source/WTF/wtf/RetainPtr.h:
(WTF::RetainPtr::fromStorageTypeHelper):
(WTF::RetainPtr<T>::autorelease):
(WTF::RetainPtr<T>::bridgingAutorelease):
(WTF::adoptCF):
(WTF::adoptNS):
(WTF::retainPtr):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list