OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/mus/bridge/wm_shell_mus.h" | 5 #include "ash/mus/bridge/wm_shell_mus.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
10 #include "ash/common/keyboard/keyboard_ui.h" | 10 #include "ash/common/keyboard/keyboard_ui.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 } // namespace | 107 } // namespace |
108 | 108 |
109 WmShellMus::WmShellMus( | 109 WmShellMus::WmShellMus( |
110 std::unique_ptr<ShellDelegate> shell_delegate, | 110 std::unique_ptr<ShellDelegate> shell_delegate, |
111 WindowManager* window_manager, | 111 WindowManager* window_manager, |
112 views::PointerWatcherEventRouter* pointer_watcher_event_router) | 112 views::PointerWatcherEventRouter* pointer_watcher_event_router) |
113 : WmShell(std::move(shell_delegate)), | 113 : WmShell(std::move(shell_delegate)), |
114 window_manager_(window_manager), | 114 window_manager_(window_manager), |
115 pointer_watcher_event_router_(pointer_watcher_event_router), | 115 pointer_watcher_event_router_(pointer_watcher_event_router), |
116 session_state_delegate_(new SessionStateDelegateStub) { | 116 session_state_delegate_(new SessionStateDelegateStub), |
| 117 blocking_pool_( |
| 118 new base::SequencedWorkerPool(3 /* max_threads */, |
| 119 "MashBlocking", |
| 120 base::TaskPriority::USER_VISIBLE)) { |
117 window_tree_client()->AddObserver(this); | 121 window_tree_client()->AddObserver(this); |
118 WmShell::Set(this); | 122 WmShell::Set(this); |
119 | 123 |
120 uint16_t accelerator_namespace_id = 0u; | 124 uint16_t accelerator_namespace_id = 0u; |
121 const bool add_result = | 125 const bool add_result = |
122 window_manager->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); | 126 window_manager->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); |
123 // WmShellMus is created early on, so that this should always succeed. | 127 // WmShellMus is created early on, so that this should always succeed. |
124 DCHECK(add_result); | 128 DCHECK(add_result); |
125 accelerator_controller_delegate_.reset( | 129 accelerator_controller_delegate_.reset( |
126 new AcceleratorControllerDelegateMus(window_manager_->connector())); | 130 new AcceleratorControllerDelegateMus(window_manager_->connector())); |
(...skipping 25 matching lines...) Expand all Loading... |
152 DeleteMaximizeModeController(); | 156 DeleteMaximizeModeController(); |
153 DeleteToastManager(); | 157 DeleteToastManager(); |
154 DeleteSystemTrayDelegate(); | 158 DeleteSystemTrayDelegate(); |
155 // Has to happen before ~MruWindowTracker. | 159 // Has to happen before ~MruWindowTracker. |
156 DeleteWindowCycleController(); | 160 DeleteWindowCycleController(); |
157 DeleteWindowSelectorController(); | 161 DeleteWindowSelectorController(); |
158 DeleteMruWindowTracker(); | 162 DeleteMruWindowTracker(); |
159 if (window_tree_client()) | 163 if (window_tree_client()) |
160 window_tree_client()->RemoveObserver(this); | 164 window_tree_client()->RemoveObserver(this); |
161 WmShell::Set(nullptr); | 165 WmShell::Set(nullptr); |
| 166 |
| 167 // Like BrowserThreadImpl, the goal is to make it impossible for ash to |
| 168 // 'infinite loop' during shutdown, but to reasonably expect that all |
| 169 // BLOCKING_SHUTDOWN tasks queued during shutdown get run. There's nothing |
| 170 // particularly scientific about the number chosen. |
| 171 const int kMaxNewShutdownBlockingTasks = 1000; |
| 172 blocking_pool_->Shutdown(kMaxNewShutdownBlockingTasks); |
162 } | 173 } |
163 | 174 |
164 // static | 175 // static |
165 WmShellMus* WmShellMus::Get() { | 176 WmShellMus* WmShellMus::Get() { |
166 return static_cast<WmShellMus*>(WmShell::Get()); | 177 return static_cast<WmShellMus*>(WmShell::Get()); |
167 } | 178 } |
168 | 179 |
169 void WmShellMus::AddRootWindowController( | 180 void WmShellMus::AddRootWindowController( |
170 WmRootWindowControllerMus* controller) { | 181 WmRootWindowControllerMus* controller) { |
171 root_window_controllers_.push_back(controller); | 182 root_window_controllers_.push_back(controller); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) { | 410 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) { |
400 pointer_watcher_event_router_->RemovePointerWatcher(watcher); | 411 pointer_watcher_event_router_->RemovePointerWatcher(watcher); |
401 } | 412 } |
402 | 413 |
403 bool WmShellMus::IsTouchDown() { | 414 bool WmShellMus::IsTouchDown() { |
404 // TODO: implement me, http://crbug.com/634967. | 415 // TODO: implement me, http://crbug.com/634967. |
405 // NOTIMPLEMENTED is too spammy here. | 416 // NOTIMPLEMENTED is too spammy here. |
406 return false; | 417 return false; |
407 } | 418 } |
408 | 419 |
| 420 base::SequencedWorkerPool* WmShellMus::GetBlockingPool() { |
| 421 return blocking_pool_.get(); |
| 422 } |
| 423 |
409 #if defined(OS_CHROMEOS) | 424 #if defined(OS_CHROMEOS) |
410 void WmShellMus::ToggleIgnoreExternalKeyboard() { | 425 void WmShellMus::ToggleIgnoreExternalKeyboard() { |
411 NOTIMPLEMENTED(); | 426 NOTIMPLEMENTED(); |
412 } | 427 } |
413 #endif // defined(OS_CHROMEOS) | 428 #endif // defined(OS_CHROMEOS) |
414 | 429 |
415 ui::WindowTreeClient* WmShellMus::window_tree_client() { | 430 ui::WindowTreeClient* WmShellMus::window_tree_client() { |
416 return window_manager_->window_tree_client(); | 431 return window_manager_->window_tree_client(); |
417 } | 432 } |
418 | 433 |
(...skipping 18 matching lines...) Expand all Loading... |
437 OnWindowActivated(gained_active, lost_active)); | 452 OnWindowActivated(gained_active, lost_active)); |
438 } | 453 } |
439 | 454 |
440 void WmShellMus::OnDidDestroyClient(ui::WindowTreeClient* client) { | 455 void WmShellMus::OnDidDestroyClient(ui::WindowTreeClient* client) { |
441 DCHECK_EQ(window_tree_client(), client); | 456 DCHECK_EQ(window_tree_client(), client); |
442 client->RemoveObserver(this); | 457 client->RemoveObserver(this); |
443 } | 458 } |
444 | 459 |
445 } // namespace mus | 460 } // namespace mus |
446 } // namespace ash | 461 } // namespace ash |
OLD | NEW |