Commit 97dfeb90 authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Prepare shelf layout manager for shutdown earlier

Starts shelf layout manager shutdown earlier at the beginning of shell
shutdown sequence (during OnShellDestroying call issued to shell
observers when the shell tear down starts).

The main goal is to prevent shelf state updates that might happen during
shutdown. For example, tablet mode controller destruction, and overview
controller destruction might cause window stacking changes, that in
turn can cause shelf state updates - both of which happen before
Shell::CloseAllRootWindowChildWindows(), which is from where
ShelfLayoutManager::PrepareForShutdown is currently called (with some
indirection).

NOTE: Calls to start shelf shutdown issued from
RootWindowController::CloseChildWindows() are kept around to handle root
window controller shutdowns that happen outside shell shutdown.

BUG=1033343

Change-Id: I86211392b45bdafd5f095bd60c774fe88e8accce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2015358Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734253}
parent 595ecc20
...@@ -427,6 +427,11 @@ void ShelfLayoutManager::InitObservers() { ...@@ -427,6 +427,11 @@ void ShelfLayoutManager::InitObservers() {
} }
void ShelfLayoutManager::PrepareForShutdown() { void ShelfLayoutManager::PrepareForShutdown() {
// This might get called twice during shell shutdown - once at the beginning,
// and once as part of root window controller shutdown.
if (in_shutdown_)
return;
in_shutdown_ = true; in_shutdown_ = true;
// Stop observing changes to avoid updating a partially destructed shelf. // Stop observing changes to avoid updating a partially destructed shelf.
...@@ -914,6 +919,13 @@ void ShelfLayoutManager::OnPinnedStateChanged(aura::Window* pinned_window) { ...@@ -914,6 +919,13 @@ void ShelfLayoutManager::OnPinnedStateChanged(aura::Window* pinned_window) {
UpdateVisibilityState(); UpdateVisibilityState();
} }
void ShelfLayoutManager::OnShellDestroying() {
// Prepare for shutdown early, to prevent window stacking changes that may
// happen during shutdown (e.g. during overview controller, or tablet mode
// controller destruction) from causing visibility and state updates.
PrepareForShutdown();
}
void ShelfLayoutManager::OnSplitViewStateChanged( void ShelfLayoutManager::OnSplitViewStateChanged(
SplitViewController::State previous_state, SplitViewController::State previous_state,
SplitViewController::State state) { SplitViewController::State state) {
......
...@@ -187,6 +187,7 @@ class ASH_EXPORT ShelfLayoutManager ...@@ -187,6 +187,7 @@ class ASH_EXPORT ShelfLayoutManager
void OnShelfAutoHideBehaviorChanged(aura::Window* root_window) override; void OnShelfAutoHideBehaviorChanged(aura::Window* root_window) override;
void OnUserWorkAreaInsetsChanged(aura::Window* root_window) override; void OnUserWorkAreaInsetsChanged(aura::Window* root_window) override;
void OnPinnedStateChanged(aura::Window* pinned_window) override; void OnPinnedStateChanged(aura::Window* pinned_window) override;
void OnShellDestroying() override;
// SplitViewObserver: // SplitViewObserver:
void OnSplitViewStateChanged(SplitViewController::State previous_state, void OnSplitViewStateChanged(SplitViewController::State previous_state,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment