Index: ash/mus/bridge/wm_shell_mus.cc |
diff --git a/ash/mus/bridge/wm_shell_mus.cc b/ash/mus/bridge/wm_shell_mus.cc |
index 78959a48aad559e9114e08841a787df655b60d2d..36dc2c4e82bd03e5416aa34b4f0a909004962b46 100644 |
--- a/ash/mus/bridge/wm_shell_mus.cc |
+++ b/ash/mus/bridge/wm_shell_mus.cc |
@@ -113,7 +113,11 @@ WmShellMus::WmShellMus( |
: WmShell(std::move(shell_delegate)), |
window_manager_(window_manager), |
pointer_watcher_event_router_(pointer_watcher_event_router), |
- session_state_delegate_(new SessionStateDelegateStub) { |
+ session_state_delegate_(new SessionStateDelegateStub), |
+ blocking_pool_( |
+ new base::SequencedWorkerPool(3 /* max_threads */, |
+ "MashBlocking", |
+ base::TaskPriority::USER_VISIBLE)) { |
window_tree_client()->AddObserver(this); |
WmShell::Set(this); |
@@ -159,6 +163,13 @@ WmShellMus::~WmShellMus() { |
if (window_tree_client()) |
window_tree_client()->RemoveObserver(this); |
WmShell::Set(nullptr); |
+ |
+ // Like BrowserThreadImpl, the goal is to make it impossible for ash to |
+ // 'infinite loop' during shutdown, but to reasonably expect that all |
+ // BLOCKING_SHUTDOWN tasks queued during shutdown get run. There's nothing |
+ // particularly scientific about the number chosen. |
+ const int kMaxNewShutdownBlockingTasks = 1000; |
+ blocking_pool_->Shutdown(kMaxNewShutdownBlockingTasks); |
} |
// static |
@@ -406,6 +417,10 @@ bool WmShellMus::IsTouchDown() { |
return false; |
} |
+base::SequencedWorkerPool* WmShellMus::GetBlockingPool() { |
+ return blocking_pool_.get(); |
+} |
+ |
#if defined(OS_CHROMEOS) |
void WmShellMus::ToggleIgnoreExternalKeyboard() { |
NOTIMPLEMENTED(); |