Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFormalise use of Agent-cluster #24159
Open
Labels
Comments
|
Also just seeing the spec now also defines the allocation and re-use of agent-cluster for similiar-origin window agents, like obtain-agent-cluster-key, and this matches our operation at the constellation such as So here some renaming and linking to the spec would be useful. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment provides a very good overview of the "agent/agent-cluster" model emerging in the HTML standard.
This sums it up nicely:
A user agent:
and "A browsing context group: Holds a map of similar-origin window keys to agent clusters. (...)"
The good news is that Servo's current architecture pretty much already follows that model, with the exception, in my opinion, of Service Worker.
We currently already have
servo/components/constellation/constellation.rs
Line 194 in a38f28f
which contains a
servo/components/constellation/constellation.rs
Line 205 in a38f28f
It's not really accurate to call our
EventLoopan "event-loop", since it actually contains, potentially, several event-loops, or should we say "agents", in the form of a single window agent, and potentially multiple dedicated worker agents.An
EventLoopcan also potentially contain several worklet agents.So, its really not an "event-loop", and in fact is fits the definition of agent-cluster very well.
So basically, we're lucky, because we pretty much already have "agent-cluster" right, and we could just rename
EventLoop->AgentCluster.Now, note that service-worker-agent
and shared-worker-agent, on the other hand, are never part of the same "agent-cluster" as a window/worklet/dedicated-worker agent.
We don't have shared-worker yet, and service-workers currently run inside an
EventLoop.So, we could move service worker to it's own "agent-cluster", kept in a map on the constellation. It's discussed at #19302
On a related note, I think the "agent-cluster" concept could influence other architectural choices. A good example is media, since an audio worklet would have to run in the agent-cluster used by a window/dedicated worker agents, yet the audio backend probably needs to run in a different process.
So there it's not so much about where "media" runs, it's rather about splitting up media so that some part(the "audio rendering thread") runs in a agent-cluster(the same one as the window agent using media), and another part runs in another process(perhaps the "main" process, or a separate one). This is a change that is discussed as part of #23807