Chromium Code Reviews| Index: components/mus/mus_app.cc |
| diff --git a/components/mus/mus_app.cc b/components/mus/mus_app.cc |
| index be7350fb566ba52e4959a2ada0461ffcf827ee93..ece8f325e15ce8fe079a48b29dc50fa034c93bf8 100644 |
| --- a/components/mus/mus_app.cc |
| +++ b/components/mus/mus_app.cc |
| @@ -17,6 +17,7 @@ |
| #include "components/mus/ws/display.h" |
| #include "components/mus/ws/display_binding.h" |
| #include "components/mus/ws/display_manager.h" |
| +#include "components/mus/ws/platform_screen.h" |
| #include "components/mus/ws/user_display_manager.h" |
| #include "components/mus/ws/window_server.h" |
| #include "components/mus/ws/window_server_test_impl.h" |
| @@ -70,7 +71,10 @@ struct MandolineUIServicesApp::UserState { |
| std::unique_ptr<ws::WindowTreeHostFactory> window_tree_host_factory; |
| }; |
| -MandolineUIServicesApp::MandolineUIServicesApp() : test_config_(false) {} |
| +MandolineUIServicesApp::MandolineUIServicesApp() |
| + : test_config_(false), |
| + platform_screen_(new ws::PlatformScreen()), |
| + weak_ptr_factory_(this) {} |
| MandolineUIServicesApp::~MandolineUIServicesApp() { |
| // Destroy |window_server_| first, since it depends on |event_source_|. |
| @@ -170,6 +174,9 @@ void MandolineUIServicesApp::Initialize(shell::Connector* connector, |
| // TODO(rjkroege): It is possible that we might want to generalize the |
| // GpuState object. |
| platform_display_init_params_.gpu_state = new GpuState(); |
| + |
| + // Gpu must be running before the PlatformScreen can be initialized. |
| + platform_screen_->Init(); |
| window_server_.reset( |
| new ws::WindowServer(this, platform_display_init_params_.surfaces_state)); |
| } |
| @@ -203,13 +210,25 @@ bool MandolineUIServicesApp::IsTestConfig() const { |
| return test_config_; |
| } |
| -void MandolineUIServicesApp::CreateDefaultDisplays() { |
| +void MandolineUIServicesApp::CreatePhysicalDisplayCallback(int64_t id, |
|
sky
2016/05/03 02:39:50
Make position match that of header.
rjkroege
2016/05/03 21:03:03
Done.
|
| + gfx::Rect bounds) { |
| + platform_display_init_params_.display_bounds = bounds; |
| + platform_display_init_params_.display_id = id; |
| + |
| // Display manages its own lifetime. |
| ws::Display* host_impl = |
| new ws::Display(window_server_.get(), platform_display_init_params_); |
| host_impl->Init(nullptr); |
| } |
| +void MandolineUIServicesApp::CreateDefaultDisplays() { |
| + // An asynchronous callback will create the Displays once the physical |
| + // displays are ready. |
| + platform_screen_->ConfigurePhysicalDisplay( |
| + base::Bind(&MandolineUIServicesApp::CreatePhysicalDisplayCallback, |
| + weak_ptr_factory_.GetWeakPtr())); |
| +} |
| + |
| void MandolineUIServicesApp::Create(shell::Connection* connection, |
| mojom::DisplayManagerRequest request) { |
| window_server_->display_manager() |