This CL introduces a lifecycle statemachine to AgentSchedulingGroupHost. The `AgentSchedulingGroupHost::state_` makes it explicit which lifestage the AgentSchedulingGroupHost is currently at, and checks if each method is called on one of the assumed states.
This is a preparatory work to introducing AgentSchedulingGroupHost shutdown, which will add more states to the state machine.
Before AgentSchedulingGroupHost-per-SiteInstance mode [1] [2] is fully implemented, we need an AgentSchedulingGroupHostObserver, which seems best tracked by this issue since it deals with shutting down an ASG(H) and its resources. We need this observer for consumers of AgentSchedulingGroupHost that assume they can track the lifetime of the AgentSchedulingGroupHost via RenderProcessHostObserver, which breaks in per-SiteInstance mode since AgentSchedulingGroupHost can go away before RenderProcessHosts do. Therefore I'll mark this as blocking crbug/1149830.
[p1 triage] @kouhei: is this work still ongoing? I'm going to mark as P2 for now since there's been no movement/update in quite a while, but please update if that's not accurate.