[webkit-changes] [WebKit/WebKit] c684d1: UniqueRef<T>::operator-> shouldn't return a const T*

Jean-Yves Avenard noreply at github.com
Wed Oct 23 16:39:46 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c684d1a74a2b18b4b347830a3adc7304439d14e8
      https://github.com/WebKit/WebKit/commit/c684d1a74a2b18b4b347830a3adc7304439d14e8
  Author: Jean-Yves Avenard <jya at apple.com>
  Date:   2024-10-23 (Wed, 23 Oct 2024)

  Changed paths:
    M Source/WTF/wtf/UniqueRef.h
    M Source/WebCore/bindings/js/WindowProxy.cpp
    M Source/WebCore/bindings/js/WindowProxy.h
    M Tools/TestWebKitAPI/Tests/WTF/UniqueRef.cpp

  Log Message:
  -----------
  UniqueRef<T>::operator-> shouldn't return a const T*
https://bugs.webkit.org/show_bug.cgi?id=281835
rdar://138270047

Reviewed by Chris Dumez.

Align UniqueRef with the behavior of Ref, RefPtr and std::unique_ptr by removing the const transitivity for the operator-> and operator*.
This facilite the adoption of UniqueRef over std::unique_ptr, allowing the use of const UniqueRef members more easily.

Add API test verifying that things still compile.

* Source/WTF/wtf/UniqueRef.h:
(WTF::UniqueRef::operator-> const):
(WTF::UniqueRef::operator* const):
(WTF::UniqueRef::operator->): Deleted.
(WTF::UniqueRef::operator*): Deleted.
* Source/WebCore/bindings/js/WindowProxy.h: Method relied on the constness of object being returned. However it was unused code, so remove it.
* Source/WebCore/bindings/js/WindowProxy.cpp:
(WebCore::WindowProxy::jsWindowProxies const): Deleted.
* Tools/TestWebKitAPI/Tests/WTF/UniqueRef.cpp:
(TestWebKitAPI::TEST(WTF, UniqueRef)):

Canonical link: https://commits.webkit.org/285628@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