[webkit-changes] [WebKit/WebKit] dbafca: Implement Observable class and subscribe method.

Keith Cirkel noreply at github.com
Tue Jul 16 23:29:17 PDT 2024


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

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-constructor.any-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-constructor.any.worker-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-constructor.window-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-takeUntil.any-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-takeUntil.any.worker-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-takeUntil.window-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-toArray.any-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-toArray.any.worker-expected.txt
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    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/js/JSDOMConvertUnion.h
    A Source/WebCore/bindings/js/JSSubscriberCustom.cpp
    M Source/WebCore/bindings/js/WebCoreBuiltinNames.h
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    A Source/WebCore/bindings/scripts/test/JS/JSTestCallbackWithFunctionOrDict.cpp
    A Source/WebCore/bindings/scripts/test/JS/JSTestCallbackWithFunctionOrDict.h
    M Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep
    A Source/WebCore/bindings/scripts/test/TestCallbackOrDict.idl
    A Source/WebCore/dom/Observable.cpp
    A Source/WebCore/dom/Observable.h
    A Source/WebCore/dom/Observable.idl
    A Source/WebCore/dom/SubscribeOptions.h
    A Source/WebCore/dom/SubscribeOptions.idl
    A Source/WebCore/dom/Subscriber.cpp
    A Source/WebCore/dom/Subscriber.h
    A Source/WebCore/dom/Subscriber.idl
    A Source/WebCore/dom/SubscriberCallback.h
    A Source/WebCore/dom/SubscriberCallback.idl
    A Source/WebCore/dom/SubscriptionObserver.h
    A Source/WebCore/dom/SubscriptionObserver.idl
    A Source/WebCore/dom/SubscriptionObserverCallback.h
    A Source/WebCore/dom/SubscriptionObserverCallback.idl

  Log Message:
  -----------
  Implement Observable class and subscribe method.
https://bugs.webkit.org/show_bug.cgi?id=276572

Reviewed by Ryan Reno.

This implements the base `Observable` class, as well as the `subscribe`
method. In addition this adds the `Subscriber` internal class allows
Observables to be subscribed to, and some additional machinery such as
`SubscribeOptions`, `SubscriptionObserver` and so on.

This also includes a fix to IDL generation to correctly generate callback
function + dictionary unions (https://github.com/whatwg/webidl/pull/1353).

This does not implement any of the prototype methods on Observable,
(other than subscribe) such as `takeUntil`, `filter`, `finally` and so
on.

* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-constructor.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-constructor.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-constructor.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-takeUntil.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-takeUntil.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-takeUntil.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-toArray.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-toArray.any.worker-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* 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:
* Source/WebCore/bindings/js/JSDOMConvertUnion.h:
* Source/WebCore/bindings/js/JSSubscriberCustom.cpp: Added.
(WebCore::JSSubscriber::visitAdditionalChildren):
* Source/WebCore/bindings/js/WebCoreBuiltinNames.h:
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(AreTypesDistinguishableForOverloadResolution):
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackWithFunctionOrDict.cpp: Added.
(WebCore::JSTestCallbackWithFunctionOrDict::JSTestCallbackWithFunctionOrDict):
(WebCore::JSTestCallbackWithFunctionOrDict::~JSTestCallbackWithFunctionOrDict):
(WebCore::JSTestCallbackWithFunctionOrDict::handleEvent):
(WebCore::JSTestCallbackWithFunctionOrDict::visitJSFunction):
(WebCore::toJS):
* Source/WebCore/bindings/scripts/test/JS/JSTestCallbackWithFunctionOrDict.h: Added.
(WebCore::toJS):
* Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep:
* Source/WebCore/bindings/scripts/test/TestCallbackOrDict.idl: Added.
* Source/WebCore/dom/Observable.cpp: Added.
(WebCore::Observable::create):
(WebCore::Observable::subscribe):
(WebCore::Observable::makeSubscriber):
(WebCore::Observable::Observable):
* Source/WebCore/dom/Observable.h: Added.
* Source/WebCore/dom/Observable.idl: Added.
* Source/WebCore/dom/SubscribeOptions.h: Added.
* Source/WebCore/dom/SubscribeOptions.idl: Added.
* Source/WebCore/dom/Subscriber.cpp: Added.
(WebCore::Subscriber::create):
(WebCore::Subscriber::Subscriber):
(WebCore::Subscriber::next):
(WebCore::Subscriber::error):
(WebCore::Subscriber::complete):
(WebCore::Subscriber::addTeardown):
(WebCore::Subscriber::followSignal):
(WebCore::Subscriber::close):
(WebCore::Subscriber::isInactiveDocument const):
(WebCore::Subscriber::reportErrorObject):
* Source/WebCore/dom/Subscriber.h: Added.
* Source/WebCore/dom/Subscriber.idl: Added.
* Source/WebCore/dom/SubscriberCallback.h: Added.
* Source/WebCore/dom/SubscriberCallback.idl: Added.
* Source/WebCore/dom/SubscriptionObserver.h: Added.
* Source/WebCore/dom/SubscriptionObserver.idl: Added.
* Source/WebCore/dom/SubscriptionObserverCallback.h: Added.
* Source/WebCore/dom/SubscriptionObserverCallback.idl: Added.

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