Fix some tab lifetime management issues in TabLifecycleUnitSource.
Move the WebContentsObserver from TabLifeCycleUnit to TabLifeCycleUnitSource, this allows for a better tracking of the WebContents lifetime, in some situation a WebContents might get detached from the TabStrip and then destroyed, which mean that we won't get a TabClosingAt notification for this tab destruction. Another solution would be to implement the TabStripModelObserver::TabDetachedAt function and track the tabs which are in a detached state but this is slightly more complex because TabDetachedAt might be called for several reasons: - A TabDetachedAt usually come after a TabClosedAt event. - TabDetachedAt might be followed by TabInsertedAt, or not if it get destroyed. because of this we won't know if we should keep the TabLifeCycleUnit for this WebContents around (i.e. if it'll get re-inserted in a tab strip) or destroy it because it's being destroyed. Observing WebContentsObserver::WebContentsDestroyed and moving the logic that was in TabClosingAt to this method address these issues, it's the same approach than the one we took in TabStatsTracker. Bug: 819352, 818454 Change-Id: Ibd3fe49b2798ade19ee781cb70eb30e52372d686 Reviewed-on: https://chromium-review.googlesource.com/952405 Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org> Reviewed-by:Chris Hamilton <chrisha@chromium.org> Cr-Commit-Position: refs/heads/master@{#541540}
Showing
Please register or sign in to comment