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

Unified Diff: services/ui/service.cc

Issue 2904993003: chromeos: changes how DisplayManagerObservers are notified (Closed)
Patch Set: cleanup Created 3 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 | « services/ui/service.h ('k') | services/ui/ws/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/service.cc
diff --git a/services/ui/service.cc b/services/ui/service.cc
index 59b670f08c12cc24c469d0e787aa55df05a85a69..5b2c9ca1d3b6774af2eb2e2a71be26b92731f7d6 100644
--- a/services/ui/service.cc
+++ b/services/ui/service.cc
@@ -29,6 +29,7 @@
#include "services/ui/ime/ime_server_impl.h"
#include "services/ui/ws/accessibility_manager.h"
#include "services/ui/ws/display_binding.h"
+#include "services/ui/ws/display_creation_config.h"
#include "services/ui/ws/display_manager.h"
#include "services/ui/ws/gpu_host.h"
#include "services/ui/ws/user_activity_monitor.h"
@@ -288,15 +289,19 @@ bool Service::IsTestConfig() const {
void Service::OnWillCreateTreeForWindowManager(
bool automatically_create_display_roots) {
- if (screen_manager_config_ != ScreenManagerConfig::UNKNOWN)
+ if (window_server_->display_creation_config() !=
+ ws::DisplayCreationConfig::UNKNOWN) {
return;
+ }
DVLOG(3) << "OnWillCreateTreeForWindowManager "
<< automatically_create_display_roots;
- screen_manager_config_ = automatically_create_display_roots
- ? ScreenManagerConfig::INTERNAL
- : ScreenManagerConfig::FORWARDING;
- if (screen_manager_config_ == ScreenManagerConfig::FORWARDING) {
+ ws::DisplayCreationConfig config = automatically_create_display_roots
+ ? ws::DisplayCreationConfig::AUTOMATIC
+ : ws::DisplayCreationConfig::MANUAL;
+ window_server_->SetDisplayCreationConfig(config);
+ if (window_server_->display_creation_config() ==
+ ws::DisplayCreationConfig::MANUAL) {
#if defined(USE_OZONE) && defined(OS_CHROMEOS)
screen_manager_ = base::MakeUnique<display::ScreenManagerForwarding>();
#else
@@ -334,8 +339,9 @@ void Service::BindClipboardRequest(
void Service::BindDisplayManagerRequest(
const service_manager::BindSourceInfo& source_info,
mojom::DisplayManagerRequest request) {
- // DisplayManagerObservers generally expect there to be at least one display.
- if (!window_server_->display_manager()->has_displays()) {
+ // Wait for the DisplayManager to be configured before binding display
+ // requests. Otherwise the client sees no displays.
+ if (!window_server_->display_manager()->IsReady()) {
std::unique_ptr<PendingRequest> pending_request(new PendingRequest);
pending_request->source_info = source_info;
pending_request->dm_request.reset(
@@ -392,7 +398,7 @@ void Service::BindWindowTreeFactoryRequest(
const service_manager::BindSourceInfo& source_info,
mojom::WindowTreeFactoryRequest request) {
AddUserIfNecessary(source_info.identity);
- if (!window_server_->display_manager()->has_displays()) {
+ if (!window_server_->display_manager()->IsReady()) {
std::unique_ptr<PendingRequest> pending_request(new PendingRequest);
pending_request->source_info = source_info;
pending_request->wtf_request.reset(
« no previous file with comments | « services/ui/service.h ('k') | services/ui/ws/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698