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

Unified Diff: services/ui/ws/display_manager.cc

Issue 2736943003: Start to decouple display::Display from ws::PlatformDisplay. (Closed)
Patch Set: Fix comments. Created 3 years, 9 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/ws/display_manager.h ('k') | services/ui/ws/display_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/display_manager.cc
diff --git a/services/ui/ws/display_manager.cc b/services/ui/ws/display_manager.cc
index 2cbaa8ebadeae044443241addcdebbd60547d170..06b19e60b73a378a599663cdf2f2de73e314b891 100644
--- a/services/ui/ws/display_manager.cc
+++ b/services/ui/ws/display_manager.cc
@@ -8,11 +8,11 @@
#include "base/memory/ptr_util.h"
#include "base/trace_event/trace_event.h"
+#include "services/ui/display/viewport_metrics.h"
#include "services/ui/ws/cursor_location_manager.h"
#include "services/ui/ws/display.h"
#include "services/ui/ws/display_binding.h"
#include "services/ui/ws/event_dispatcher.h"
-#include "services/ui/ws/platform_display_init_params.h"
#include "services/ui/ws/server_window.h"
#include "services/ui/ws/user_display_manager.h"
#include "services/ui/ws/user_display_manager_delegate.h"
@@ -98,9 +98,9 @@ std::set<const Display*> DisplayManager::displays() const {
return ret_value;
}
-void DisplayManager::OnDisplayUpdate(Display* display) {
+void DisplayManager::OnDisplayUpdate(const display::Display& display) {
for (const auto& pair : user_display_managers_)
- pair.second->OnDisplayUpdate(display->ToDisplay());
+ pair.second->OnDisplayUpdate(display);
}
Display* DisplayManager::GetDisplayContaining(const ServerWindow* window) {
@@ -181,34 +181,33 @@ void DisplayManager::OnActiveUserIdChanged(const UserId& previously_active_id,
current_window_manager_state->Activate(mouse_location_on_screen);
}
-void DisplayManager::OnDisplayAdded(int64_t id,
+void DisplayManager::OnDisplayAdded(const display::Display& display,
const display::ViewportMetrics& metrics) {
- TRACE_EVENT1("mus-ws", "OnDisplayAdded", "id", id);
- PlatformDisplayInitParams params;
- params.display_id = id;
- params.metrics = metrics;
+ DVLOG(3) << "OnDisplayAdded: " << display.ToString();
- ws::Display* display = new ws::Display(window_server_);
- display->Init(params, nullptr);
+ ws::Display* ws_display = new ws::Display(window_server_);
+ ws_display->SetDisplay(display);
+ ws_display->Init(metrics, nullptr);
}
-void DisplayManager::OnDisplayRemoved(int64_t id) {
- TRACE_EVENT1("mus-ws", "OnDisplayRemoved", "id", id);
- Display* display = GetDisplayById(id);
+void DisplayManager::OnDisplayRemoved(int64_t display_id) {
+ DVLOG(3) << "OnDisplayRemoved: " << display_id;
+ Display* display = GetDisplayById(display_id);
if (display)
DestroyDisplay(display);
}
void DisplayManager::OnDisplayModified(
- int64_t id,
+ const display::Display& display,
const display::ViewportMetrics& metrics) {
- TRACE_EVENT1("mus-ws", "OnDisplayModified", "id", id);
+ DVLOG(3) << "OnDisplayModified: " << display.ToString();
- Display* display = GetDisplayById(id);
- DCHECK(display);
+ Display* ws_display = GetDisplayById(display.id());
+ DCHECK(ws_display);
+ ws_display->SetDisplay(display);
// Update the platform display and check if anything has actually changed.
- if (!display->platform_display()->UpdateViewportMetrics(metrics))
+ if (!ws_display->platform_display()->UpdateViewportMetrics(metrics))
return;
// Send IPCs to WM clients first with new display information.
@@ -216,15 +215,16 @@ void DisplayManager::OnDisplayModified(
window_server_->window_manager_window_tree_factory_set()->GetFactories();
for (WindowManagerWindowTreeFactory* factory : factories) {
if (factory->window_tree())
- factory->window_tree()->OnWmDisplayModified(display->ToDisplay());
+ factory->window_tree()->OnWmDisplayModified(display);
}
// Change the root ServerWindow size after sending IPC to WM.
- display->OnViewportMetricsChanged(metrics);
+ ws_display->OnViewportMetricsChanged(metrics);
OnDisplayUpdate(display);
}
void DisplayManager::OnPrimaryDisplayChanged(int64_t primary_display_id) {
+ DVLOG(3) << "OnPrimaryDisplayChanged: " << primary_display_id;
// TODO(kylechar): Send IPCs to WM clients first.
// Send IPCs to any DisplayManagerObservers.
« no previous file with comments | « services/ui/ws/display_manager.h ('k') | services/ui/ws/display_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698