Currently, Media Route Providers are informed of PresentationConnections closing via PresentationServiceImpl observing navigation and issuing MediaRouter::DetachRoute() calls to MediaRouter. As we replace PresentationService API calls with PresentationConnection, it would be better to do the following:
- Move the MediaRouter::DetachRoute() that's made from PresentationServiceImpl::CloseConnection() to BrowserPresentationConnectionProxy::RequestClose(). Note that Blink currently calls both RequestClose() and CloseConnection(). This takes care of the case when the frame calls close() on the presentation connection.
- PresentationController to tear down / remove PresentationConnections during ContextDestroyed(). This should take care of the navigation case, and also makes sure resources are cleaned up.
- On the native Cast MRP side, we will implement RequestClose() to close the Mojo pipes and remove the corresponding client from the CastActivityRecord.
Comment 1 by powerb@chromium.org
, Sep 11