From 3d9b41d1086131f21cd87a1957344a6fdb7e1748 Mon Sep 17 00:00:00 2001 From: Fernando Serboncini Date: Mon, 27 Aug 2018 12:02:51 -0400 Subject: [PATCH] Add requestAnimationFrame() in workers Fixes #3587. Based on the proposal at https://github.com/junov/OffscreenCanvasAnimation/blob/2e0546417d4f45d194270a67a1cdf303f2e0ef88/OffscreenCanvasAnimation.md. This introduces a new AnimationFrameProvider mixin interface to contain requestAnimationFrame() and cancelAnimationFrame(). It's included in Window and DedicatedWorkerGlobalScope. In addition to generalizing them to work on both objects, the two methods were rewritten editorially to be based on Infra primitives. This change also introduces the concept of updating the rendering of worker event loops. --- source | 208 +++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 150 insertions(+), 58 deletions(-) diff --git a/source b/source index 6392e47c64e..7751caf4c4f 100644 --- a/source +++ b/source @@ -2540,8 +2540,10 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute value, entry, exists, - getting the value of an entry, and - setting the value of an entry + getting the value of an entry, + setting the value of an entry, + removing an entry, and + iterate
  • The list data structure and the associated definitions for append, replace, @@ -26206,9 +26208,9 @@ img.decode().then(() => {

    Because the decode() method attempts to ensure that the decoded image data is available for at least one frame, it can be combined with the requestAnimationFrame() API. This means it can - be used with coding styles or frameworks that ensure that all DOM modifications are batched - together as animation frame + data-x="dom-AnimationFrameProvider-requestAnimationFrame">requestAnimationFrame() API. + This means it can be used with coding styles or frameworks that ensure that all DOM modifications + are batched together as animation frame callbacks:

    const container = document.querySelector("#container");
    @@ -65456,7 +65458,8 @@ interface OffscreenCanvasRenderingContext2D {
         

    Copies the rendering context's bitmap to the bitmap of the placeholder canvas element of the associated OffscreenCanvas object. The copy - operation is asynchronous.

    + operation is synchronous. Calling this method is not needed for the transfer, since it happens + automatically during the event loop execution.

    offscreenCanvas = offscreenCanvasRenderingContext2D . Window : Eve DOMString? prompt(optional DOMString message = "", optional DOMString default = ""); void print(); - unsigned long requestAnimationFrame(FrameRequestCallback callback); - void cancelAnimationFrame(unsigned long handle); - void postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []); }; Window includes GlobalEventHandlers; -Window includes WindowEventHandlers; - -callback FrameRequestCallback = void (DOMHighResTimeStamp time);
    +Window includes WindowEventHandlers;