| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/window_manager_application.h" | 5 #include "ash/mus/window_manager_application.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/mojo_interface_factory.h" | 10 #include "ash/common/mojo_interface_factory.h" |
| 11 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 12 #include "ash/mus/window_manager.h" | 12 #include "ash/mus/window_manager.h" |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "services/service_manager/public/cpp/connection.h" | 15 #include "services/service_manager/public/cpp/connection.h" |
| 16 #include "services/service_manager/public/cpp/connector.h" | 16 #include "services/service_manager/public/cpp/connector.h" |
| 17 #include "services/service_manager/public/cpp/service_context.h" | 17 #include "services/service_manager/public/cpp/service_context.h" |
| 18 #include "services/tracing/public/cpp/provider.h" | 18 #include "services/tracing/public/cpp/provider.h" |
| 19 #include "services/ui/common/accelerator_util.h" | 19 #include "services/ui/common/accelerator_util.h" |
| 20 #include "services/ui/public/cpp/gpu/gpu_service.h" | 20 #include "services/ui/public/cpp/gpu/gpu.h" |
| 21 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
| 22 #include "ui/aura/mus/mus_context_factory.h" | 22 #include "ui/aura/mus/mus_context_factory.h" |
| 23 #include "ui/aura/mus/window_tree_client.h" | 23 #include "ui/aura/mus/window_tree_client.h" |
| 24 #include "ui/events/event.h" | 24 #include "ui/events/event.h" |
| 25 #include "ui/message_center/message_center.h" | 25 #include "ui/message_center/message_center.h" |
| 26 #include "ui/views/mus/aura_init.h" | 26 #include "ui/views/mus/aura_init.h" |
| 27 #include "ui/views/mus/surface_context_factory.h" | 27 #include "ui/views/mus/surface_context_factory.h" |
| 28 | 28 |
| 29 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
| 30 #include "ash/common/system/chromeos/power/power_status.h" | 30 #include "ash/common/system/chromeos/power/power_status.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 50 | 50 |
| 51 if (blocking_pool_) { | 51 if (blocking_pool_) { |
| 52 // Like BrowserThreadImpl, the goal is to make it impossible for ash to | 52 // Like BrowserThreadImpl, the goal is to make it impossible for ash to |
| 53 // 'infinite loop' during shutdown, but to reasonably expect that all | 53 // 'infinite loop' during shutdown, but to reasonably expect that all |
| 54 // BLOCKING_SHUTDOWN tasks queued during shutdown get run. There's nothing | 54 // BLOCKING_SHUTDOWN tasks queued during shutdown get run. There's nothing |
| 55 // particularly scientific about the number chosen. | 55 // particularly scientific about the number chosen. |
| 56 const int kMaxNewShutdownBlockingTasks = 1000; | 56 const int kMaxNewShutdownBlockingTasks = 1000; |
| 57 blocking_pool_->Shutdown(kMaxNewShutdownBlockingTasks); | 57 blocking_pool_->Shutdown(kMaxNewShutdownBlockingTasks); |
| 58 } | 58 } |
| 59 | 59 |
| 60 gpu_service_.reset(); | 60 gpu_.reset(); |
| 61 #if defined(OS_CHROMEOS) | 61 #if defined(OS_CHROMEOS) |
| 62 statistics_provider_.reset(); | 62 statistics_provider_.reset(); |
| 63 #endif | 63 #endif |
| 64 ShutdownComponents(); | 64 ShutdownComponents(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void WindowManagerApplication::InitWindowManager( | 67 void WindowManagerApplication::InitWindowManager( |
| 68 std::unique_ptr<aura::WindowTreeClient> window_tree_client, | 68 std::unique_ptr<aura::WindowTreeClient> window_tree_client, |
| 69 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool) { | 69 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool) { |
| 70 // Tests may have already set the WindowTreeClient. | 70 // Tests may have already set the WindowTreeClient. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 chromeos::DBusThreadManager::Shutdown(); | 115 chromeos::DBusThreadManager::Shutdown(); |
| 116 #endif | 116 #endif |
| 117 message_center::MessageCenter::Shutdown(); | 117 message_center::MessageCenter::Shutdown(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void WindowManagerApplication::OnStart() { | 120 void WindowManagerApplication::OnStart() { |
| 121 aura_init_ = base::MakeUnique<views::AuraInit>( | 121 aura_init_ = base::MakeUnique<views::AuraInit>( |
| 122 context()->connector(), context()->identity(), "ash_mus_resources.pak", | 122 context()->connector(), context()->identity(), "ash_mus_resources.pak", |
| 123 "ash_mus_resources_200.pak", nullptr, | 123 "ash_mus_resources_200.pak", nullptr, |
| 124 views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER); | 124 views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER); |
| 125 gpu_service_ = ui::GpuService::Create(context()->connector()); | 125 gpu_ = ui::Gpu::Create(context()->connector()); |
| 126 compositor_context_factory_ = | 126 compositor_context_factory_ = |
| 127 base::MakeUnique<aura::MusContextFactory>(gpu_service_.get()); | 127 base::MakeUnique<aura::MusContextFactory>(gpu_.get()); |
| 128 aura::Env::GetInstance()->set_context_factory( | 128 aura::Env::GetInstance()->set_context_factory( |
| 129 compositor_context_factory_.get()); | 129 compositor_context_factory_.get()); |
| 130 window_manager_.reset(new WindowManager(context()->connector())); | 130 window_manager_.reset(new WindowManager(context()->connector())); |
| 131 | 131 |
| 132 MaterialDesignController::Initialize(); | 132 MaterialDesignController::Initialize(); |
| 133 | 133 |
| 134 tracing_.Initialize(context()->connector(), context()->identity().name()); | 134 tracing_.Initialize(context()->connector(), context()->identity().name()); |
| 135 | 135 |
| 136 std::unique_ptr<aura::WindowTreeClient> window_tree_client = | 136 std::unique_ptr<aura::WindowTreeClient> window_tree_client = |
| 137 base::MakeUnique<aura::WindowTreeClient>( | 137 base::MakeUnique<aura::WindowTreeClient>( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 159 } | 159 } |
| 160 return true; | 160 return true; |
| 161 } | 161 } |
| 162 | 162 |
| 163 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { | 163 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { |
| 164 window_manager_->SetScreenLocked(locked); | 164 window_manager_->SetScreenLocked(locked); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace mus | 167 } // namespace mus |
| 168 } // namespace ash | 168 } // namespace ash |
| OLD | NEW |