Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2431)

Unified Diff: ash/mus/window_manager_application.cc

Issue 2318223003: mash: Migrate wallpaper controllers to ash/common. (Closed)
Patch Set: Fix nit. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | ash/root_window_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/window_manager_application.cc
diff --git a/ash/mus/window_manager_application.cc b/ash/mus/window_manager_application.cc
index eae07e130d2e6929fe5446d29d9e953236268399..614722a09855dfa1c52b67590b40248fdbe1bb0c 100644
--- a/ash/mus/window_manager_application.cc
+++ b/ash/mus/window_manager_application.cc
@@ -83,6 +83,16 @@ WindowManagerApplication::~WindowManagerApplication() {
// Destroy the WindowManager while still valid. This way we ensure
// OnWillDestroyRootWindowController() is called (if it hasn't been already).
window_manager_.reset();
+
+ if (blocking_pool_) {
+ // 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);
+ }
+
gpu_service_.reset();
#if defined(OS_CHROMEOS)
statistics_provider_.reset();
@@ -96,7 +106,8 @@ void WindowManagerApplication::OnAcceleratorRegistrarDestroyed(
}
void WindowManagerApplication::InitWindowManager(
- std::unique_ptr<ui::WindowTreeClient> window_tree_client) {
+ std::unique_ptr<ui::WindowTreeClient> window_tree_client,
+ const scoped_refptr<base::SequencedWorkerPool>& blocking_pool) {
InitializeComponents();
#if defined(OS_CHROMEOS)
// TODO(jamescook): Refactor StatisticsProvider so we can get just the data
@@ -107,7 +118,7 @@ void WindowManagerApplication::InitWindowManager(
statistics_provider_->SetMachineStatistic("initial_locale", "en-US");
statistics_provider_->SetMachineStatistic("keyboard_layout", "");
#endif
- window_manager_->Init(std::move(window_tree_client));
+ window_manager_->Init(std::move(window_tree_client), blocking_pool);
}
void WindowManagerApplication::OnStart(const shell::Identity& identity) {
@@ -131,7 +142,11 @@ void WindowManagerApplication::OnStart(const shell::Identity& identity) {
native_widget_factory_mus_.reset(
new NativeWidgetFactoryMus(window_manager_.get()));
- InitWindowManager(std::move(window_tree_client));
+ const size_t kMaxNumberThreads = 3u; // Matches that of content.
+ const char kThreadNamePrefix[] = "MashBlocking";
+ blocking_pool_ = new base::SequencedWorkerPool(
+ kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE);
+ InitWindowManager(std::move(window_tree_client), blocking_pool_);
}
bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity,
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | ash/root_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698