ServiceManager: Simplify Instance lifetime management
Makes Instance ownership and lifetime management easier to follow. Root instances are now explicitly owned by the ServiceManager and non-root instances are explicitly owned by their parent Instance. OnInstanceError always destroys the Instance, either by removing it from the root instance set or delegating to the parent Instance. This avoids the need for children to re-enter their parent on destruction. Notification logic has been extracted from OnInstanceError and moved to a new OnInstanceStopped, which is always called by each Instance's destructor. This allows parents to delete their own children without calling through to OnInstanceError, while still allowing the ServiceManager to know about the destruction and dispatch notifications accordingly. InstanceErrorType is removed: if an Instance becomes unreachable it's simply removed from the identity map via a new OnInstanceUnreachable call. BUG=640488 Review-Url: https://codereview.chromium.org/2341853002 Cr-Commit-Position: refs/heads/master@{#418643}
Showing
Please register or sign in to comment