Intent to Implement: Worklets

214 views
Skip to first unread message

Ian Kilpatrick

unread,
Dec 8, 2015, 12:43:52 PM12/8/15
to blink-dev

Contact emails

ikilp...@chromium.org


Spec

https://drafts.css-houdini.org/worklets/


Summary

Worklets define a new javascript execution context. This execution context is designed to allow developers to write code which is intended to be run synchronously within the rendering engine, however independent of the main user javascript.


Motivation

This spec was developed in order to allow extension points for CSS (as part of the Houdini effort), which requires running user script in the middle of layout, paint, etc.


As a concrete example, this allows blink to call into user defined layout code, and not have to worry about that code re-invalidating layout, removing DOM, etc.


Worklets are intended to be used for:

  • Houdini related specifications: (CSS Paint API, CSS Layout API, etc)

  • CompositorWorker


In addition they are being considered for:


Without this specification, the above would rely on Workers instead, which don’t allow multiple execution contexts (which means no work shifting between threads), have APIs such as setTimeout (would need to define what this means in a synchronous setting), and don’t have code isolation.


Interoperability and Compatibility Risk

Compatibility Risk: None, adding a new primitive to the web platform.

Interoperability Risk: None (yet). Not requesting permission to ship. Implementing worklets is meant to unblock implementation & experimentation work on current proposals wishing to use this feature. The implementation and experimentation will allow us to inform the specification.


Ongoing technical constraints

None. Worklets aren’t defined to run on a particular thread, or specify the number of them running. Other specifications which use worklets may specify that a particular WorkletGlobalScope should run on a particular thread.


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes.


OWP launch tracking bug

https://crbug.com/567358


Link to entry on the feature dashboard

https://www.chromestatus.com/features/5275637463908352


Requesting approval to ship?

No.


Kentaro Hara

unread,
Dec 8, 2015, 7:55:50 PM12/8/15
to Ian Kilpatrick, blink-dev
Do you have a design document that explains how the Worklets are going to be implemented in Blink (the relationship with v8::Isolate, v8::Context, ExecutionContext, GlobalScope etc)?


--
Kentaro Hara, Tokyo, Japan

Ian Kilpatrick

unread,
Dec 9, 2015, 4:22:36 PM12/9/15
to Kentaro Hara, blink-dev
Yes, have a look here.

I have a very simple stub implementation here. This doesn't contain devtools integration or multiple WorkletGlobalScopes etc. However it should cover most of the details for bindings.

Kentaro Hara

unread,
Dec 10, 2015, 7:04:23 PM12/10/15
to Ian Kilpatrick, blink-dev
Thanks for the design doc!

I'm not familiar with Worklets enough to say go or non-go to this feature, but from the perspective of the architectural design & implementation complexity, it looks good to me.



Reply all
Reply to author
Forward
0 new messages