[webkit-changes] [WebKit/WebKit] 2b4024: Implement Observable#map

Keith Cirkel noreply at github.com
Tue Jul 30 13:07:25 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2b4024b9e553db21230d1f620f7e33fa3f41241e
      https://github.com/WebKit/WebKit/commit/2b4024b9e553db21230d1f620f7e33fa3f41241e
  Author: Keith Cirkel <webkit at keithcirkel.co.uk>
  Date:   2024-07-30 (Tue, 30 Jul 2024)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-map.any-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-map.any.worker-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-map.window-expected.txt
    M Source/WebCore/CMakeLists.txt
    M Source/WebCore/DerivedSources-input.xcfilelist
    M Source/WebCore/DerivedSources-output.xcfilelist
    M Source/WebCore/DerivedSources.make
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/bindings/IDLTypes.h
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionGenerateIsReachable.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionGenerateIsReachable.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithVariadic.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithVariadic.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackWithFunctionOrDict.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackWithFunctionOrDict.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestVoidCallbackFunction.h
    A Source/WebCore/dom/InternalObserverMap.cpp
    A Source/WebCore/dom/InternalObserverMap.h
    A Source/WebCore/dom/MapperCallback.h
    A Source/WebCore/dom/MapperCallback.idl
    M Source/WebCore/dom/Observable.cpp
    M Source/WebCore/dom/Observable.h
    M Source/WebCore/dom/Observable.idl

  Log Message:
  -----------
  Implement Observable#map
https://bugs.webkit.org/show_bug.cgi?id=277222

Reviewed by Sam Weinig.

This adds the map operator to Observable, using the new
InternalObserverMap and SubscriberCallbackMap specialisations.

This also adds a new `MapperCallback` IDL which represents the mapping
function Observable#map takes. It's similar to `PredicateCallback` but
the return value is an `any` not `bool`.

* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-map.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-map.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-map.window-expected.txt:
* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-input.xcfilelist:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/IDLTypes.h:
  Added a new `CallbackReturnType` type which IDLAny assigns as
  JSC::JSValue. This enables safely changing CodeGeneratorJS to move
  callback returns from `ImplementationType` to `CallbackReturnType`,
  making the value of IDLAny propertly map to `JSC::JSValue` rather
  than `JSC::Strong<JSC::Unknown>` (the template type of IDLAny).
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
  Change GenerateCallbackHeaderContent and
  GenerateCallbackImplementationContent to use the new
  `CallbackReturnType` property for the return value (see above IDLTypes
  comment).
(GenerateCallbackHeaderContent):
(GenerateCallbackImplementationContent):
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
(WebCore::JSTestCallbackFunction::handleEvent):
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h:
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionGenerateIsReachable.cpp:
(WebCore::JSTestCallbackFunctionGenerateIsReachable::handleEvent):
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionGenerateIsReachable.h:
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
(WebCore::JSTestCallbackFunctionRethrow::handleEvent):
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.h:
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp:
(WebCore::JSTestCallbackFunctionWithThisObject::handleEvent):
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.h:
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
(WebCore::JSTestCallbackFunctionWithTypedefs::handleEvent):
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithVariadic.cpp:
(WebCore::JSTestCallbackFunctionWithVariadic::handleEvent):
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithVariadic.h:
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
(WebCore::JSTestCallbackInterface::callbackWithNoParam):
(WebCore::JSTestCallbackInterface::callbackWithArrayParam):
(WebCore::JSTestCallbackInterface::callbackWithSerializedScriptValueParam):
(WebCore::JSTestCallbackInterface::callbackWithStringList):
(WebCore::JSTestCallbackInterface::callbackWithBoolean):
(WebCore::JSTestCallbackInterface::callbackRequiresThisToPass):
(WebCore::JSTestCallbackInterface::callbackWithAReturnValue):
(WebCore::JSTestCallbackInterface::callbackThatRethrowsExceptions):
(WebCore::JSTestCallbackInterface::callbackWithThisObject):
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h:
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackWithFunctionOrDict.cpp:
(WebCore::JSTestCallbackWithFunctionOrDict::handleEvent):
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackWithFunctionOrDict.h:
* Source/WebCore/bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
(WebCore::JSTestVoidCallbackFunction::handleEvent):
* Source/WebCore/bindings/scripts/test/JS/JSTestVoidCallbackFunction.h:
* Source/WebCore/dom/InternalObserverMap.cpp: Added.
(WebCore::createSubscriberCallbackMap):
* Source/WebCore/dom/InternalObserverMap.h: Copied from Source/WebCore/dom/Observable.idl.
* Source/WebCore/dom/MapperCallback.h: Copied from Source/WebCore/dom/Observable.idl.
* Source/WebCore/dom/MapperCallback.idl: Copied from Source/WebCore/dom/Observable.idl.
* Source/WebCore/dom/Observable.cpp:
(WebCore::Observable::map):
* Source/WebCore/dom/Observable.h:
* Source/WebCore/dom/Observable.idl:

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