Skip to content

Making worker/worklet agent allocation imperative #5210

Closed

Description

@domenic

In working on origin isolation I am finding it a bit annoying that only window agent creation is imperative. Let's figure out what it would look like to convert everything else.

Here's my first attempt:

  • End goal:
    • all realm creation ("create a new JavaScript realm" calls) include an agent pointer, either created on the spot or looked up from elsewhere.
    • We delete the "can share memory with" equivalence relation and associated implicit definitions. (Maybe we keep them as informative?)
  • Shared worker agents: creates a new agent and agent cluster on the spot. Does not need to store it in any map; all access can go through the shared worker.
  • Service worker agents: same as shared worker agents.
  • Worklet agent: grabs the owner document's agent cluster. Creates a new agent inside the agent cluster.
  • Dedicated worker agent: grabs the "relevant owner to add"'s agent cluster. Creates a new agent inside the agent cluster.

Hmm, but how exactly do we grab the owner's agent cluster? We can get from document/WorkerGlobalScope to realm to agent, but not from agent to agent cluster. We could use spec magic and say "the agent cluster that contains the agent", but maybe it would be better to be more explicit and go via the browsing context group, etc.?

Activity

  1. added
    clarification
    topic: agent
    on Jan 14, 2020
  2. annevk commented on Jan 15, 2020

    @annevk
    Member

    Duplicate of #4339?

  3. domenic commented on Jan 15, 2020

    @domenic
    MemberAuthor

    I can't really understand #4339, but maybe?

  4. annevk commented on Jan 15, 2020

    @annevk
    Member

    You mean the text it's citing? It's the first step of run a worker:

    Create a separate parallel execution environment (i.e. a separate thread or process or equivalent construct), and run the rest of these steps in that context.

  5. domenic commented on Jan 15, 2020

    @domenic
    MemberAuthor

    Oh, I didn't realize it was citing text. That sounds pretty different than what I'm discussing in the OP of this issue, though, which is the current implicit definition of agent clusters via "can share memory with" equivalence relation, and agents via "allocate at the appropriate time".

  6. annevk commented on Jan 16, 2020

    @annevk
    Member

    Well, the intended solution is the same, but sure.

  7. added 2 commits that reference this issue on Mar 27, 2020
    760880f
    fe77096
  8. added a commit that references this issue on Mar 31, 2020
    12a2a56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clarificationtopic: agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions