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

Unified Diff: components/mus/mus_app.cc

Issue 1899923002: Basic display management for mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix chromecast build Created 4 years, 7 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 | « components/mus/mus_app.h ('k') | components/mus/ws/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/mus_app.cc
diff --git a/components/mus/mus_app.cc b/components/mus/mus_app.cc
index be7350fb566ba52e4959a2ada0461ffcf827ee93..67a94a6104db4125b32ae10adbaa75e3bf2d13dd 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"
@@ -33,6 +34,7 @@
#include "ui/base/ui_base_paths.h"
#include "ui/events/event_switches.h"
#include "ui/events/platform/platform_event_source.h"
+#include "ui/gfx/geometry/rect.h"
#include "ui/gl/gl_surface.h"
#if defined(USE_X11)
@@ -70,7 +72,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_(ws::PlatformScreen::Create()),
+ weak_ptr_factory_(this) {}
MandolineUIServicesApp::~MandolineUIServicesApp() {
// Destroy |window_server_| first, since it depends on |event_source_|.
@@ -170,6 +175,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));
}
@@ -204,10 +212,11 @@ bool MandolineUIServicesApp::IsTestConfig() const {
}
void MandolineUIServicesApp::CreateDefaultDisplays() {
- // Display manages its own lifetime.
- ws::Display* host_impl =
- new ws::Display(window_server_.get(), platform_display_init_params_);
- host_impl->Init(nullptr);
+ // An asynchronous callback will create the Displays once the physical
+ // displays are ready.
+ platform_screen_->ConfigurePhysicalDisplay(
+ base::Bind(&MandolineUIServicesApp::OnCreatedPhysicalDisplay,
+ weak_ptr_factory_.GetWeakPtr()));
}
void MandolineUIServicesApp::Create(shell::Connection* connection,
@@ -273,4 +282,15 @@ void MandolineUIServicesApp::Create(shell::Connection* connection,
new GpuImpl(std::move(request), platform_display_init_params_.gpu_state);
}
+void MandolineUIServicesApp::OnCreatedPhysicalDisplay(int64_t id,
+ const 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);
+}
+
} // namespace mus
« no previous file with comments | « components/mus/mus_app.h ('k') | components/mus/ws/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698