In file dom/media/MediaManager.cpp
Iterates over child DocShell tree, and for each one with a Window, pulls out its UserMediaWindowListener.
Calls a visitor callback on every such UserMediaWindowListener.
Four users each passing their own callback logic:
- Calls StopRawId() on listener with ID of device.
- Should be invoked rarely, can be switched to using IPC to invoke on parent process.
- Calls RemoveAll on listeners.
- Itself invoked by Navigator::OnNavigation
- Convert to using BrowsingContext.
- If any children are out-of-process, collect root of each out-of-process subtree and send async-IPC to chrome to forward listener removal.
- Retrieves media capture state (Enabled|Disabled|Off for camera/browser/etc.), merges it across the tree, and returns it.
- Used by WebRTC code.
- Seems OK to use sync IPC here - ask process to collate this across windows.
- WindowContext seems most reasonable place for this state.
- Calls StopSharing() on listener.
- Rare call.
- Can use IPC too.