[webkit-changes] [WebKit/WebKit] 8bf6f2: Add Take Observable operator

Keith Cirkel noreply at github.com
Sat Jul 27 18:02:41 PDT 2024


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

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-take.any-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-take.any.worker-expected.txt
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/bindings/js/JSSubscriberCustom.cpp
    M Source/WebCore/dom/InternalObserverFromScript.cpp
    A Source/WebCore/dom/InternalObserverTake.cpp
    A Source/WebCore/dom/InternalObserverTake.h
    M Source/WebCore/dom/Observable.cpp
    M Source/WebCore/dom/Observable.h
    M Source/WebCore/dom/Observable.idl
    M Source/WebCore/dom/Subscriber.cpp
    M Source/WebCore/dom/Subscriber.h

  Log Message:
  -----------
  Add Take Observable operator
https://bugs.webkit.org/show_bug.cgi?id=277103

Reviewed by Darin Adler.

This adds the .take(amount) operator for Observables; implementing this
behind a InternalObserverTake backing class and subsequent
SubscribeCallback specialisation.

* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-take.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-take.any.worker-expected.txt:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/JSSubscriberCustom.cpp:
* Source/WebCore/dom/InternalObserverFromScript.cpp:
* Source/WebCore/dom/InternalObserverTake.cpp: Added.
  Implements createSubscriberCallbackTake as well as the
  InternalObserverTake and SubscribeCallbackTake classes.
(WebCore::createSubscriberCallbackTake):
* Source/WebCore/dom/InternalObserverTake.h: Copied from Source/WebCore/dom/Observable.idl.
  Adds the createSubscriberCallbackTake function which creates a callback to
  handle the logic for `take()`.
* Source/WebCore/dom/Observable.cpp:
(WebCore::Observable::create):
  Drop `ExceptionOr<>` which was unused, and made it difficult to easily
  create new operators (which also don't need `ExceptionOr<>`).
(WebCore::Observable::take):
  Implement the take() operator.
* Source/WebCore/dom/Observable.h:
* Source/WebCore/dom/Observable.idl:
* Source/WebCore/dom/Subscriber.cpp:
(WebCore::Subscriber::observerConcurrently):
  Moved out of the header file during refactor to add
  visitAdditionalChildren.
(WebCore::Subscriber::visitAdditionalChildren):
  Added to traverse into InternalObserver to allow for objects in
  InternalObserver to be marked.
* Source/WebCore/dom/Subscriber.h:

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