This directory contains the base implementation of all worker and worklet types. Also, this contains the implementation of the Web Workers API (Dedicated Worker and Shared Worker) and Worklets API.
Worklets always run in the same renderer process with a parent document that starts the worklet like the in-process-workers.
Classes in this directory are named with the following conventions, there're still some exceptions though.
WorkerOrWorklet
prefix: Classes commonly used for workers and worklets (e.g., WorkerOrWorkletGlobalScope
).Worker
/ Worklet
prefix: Classes used for workers or worklets (e.g., WorkerGlobalScope
).Threaded
prefix: Classes used for workers and threaded worklets (e.g., ThreadedMessagingProxyBase
).MainThreadWorklet
prefix: Classes used for main thread worklets (e.g., MainThreadWorkletGlobalScope
).Thread hopping between the main (parent) thread and a worker thread is handled by proxy classes.
MessagingProxy
is the main (parent) thread side proxy that communicates to the worker thread.ObjectProxy
is the worker thread side proxy that communicates to the main (parent) thread. Object
indicates a worker/worklet JavaScript object on the parent execution context.