Index: services/ui/ws/window_server.cc |
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc |
index e02e3c84bb2681f73d44cb28d41ac7cc8d0de2f3..ec49bd263d4d0c61b4b472d37f555c7df903c57d 100644 |
--- a/services/ui/ws/window_server.cc |
+++ b/services/ui/ws/window_server.cc |
@@ -10,6 +10,7 @@ |
#include "base/logging.h" |
#include "base/memory/ptr_util.h" |
#include "base/stl_util.h" |
+#include "cc/surfaces/surface.h" |
#include "services/shell/public/cpp/connection.h" |
#include "services/ui/ws/display.h" |
#include "services/ui/ws/display_binding.h" |
@@ -17,6 +18,7 @@ |
#include "services/ui/ws/gpu_service_proxy.h" |
#include "services/ui/ws/operation.h" |
#include "services/ui/ws/server_window.h" |
+#include "services/ui/ws/server_window_surface_manager.h" |
#include "services/ui/ws/user_activity_monitor.h" |
#include "services/ui/ws/window_coordinate_conversions.h" |
#include "services/ui/ws/window_manager_access_policy.h" |
@@ -46,7 +48,7 @@ struct WindowServer::CurrentDragLoopState { |
WindowServer::WindowServer(WindowServerDelegate* delegate) |
: delegate_(delegate), |
- surfaces_state_(new SurfacesState()), |
+ display_compositor_(new surfaces::DisplayCompositor(this)), |
next_client_id_(1), |
display_manager_(new DisplayManager(this, &user_id_tracker_)), |
current_operation_(nullptr), |
@@ -375,6 +377,26 @@ void WindowServer::ProcessWindowBoundsChanged(const ServerWindow* window, |
} |
} |
+void WindowServer::ProcessWindowSurfaceCreated( |
+ ServerWindow* window, |
+ const gfx::Size& size, |
+ float device_scale_factor, |
+ const cc::SurfaceId& surface_id) { |
+ ServerWindowSurfaceManager* surface_manager = |
+ window->GetOrCreateSurfaceManager(); |
+ for (auto& pair : tree_map_) { |
+ cc::SurfaceSequence surface_sequence = |
+ surface_manager->CreateSurfaceSequence(); |
+ surfaces::DisplayCompositor* compositor = GetDisplayCompositor(); |
+ compositor->manager() |
+ ->GetSurfaceForId(surface_id) |
+ ->AddDestructionDependency(surface_sequence); |
+ pair.second->ProcessWindowSurfaceCreated(window, size, |
+ 1.0f /* device_scale_factor */, |
+ surface_id, surface_sequence); |
+ } |
+} |
+ |
void WindowServer::ProcessClientAreaChanged( |
const ServerWindow* window, |
const gfx::Insets& new_client_area, |
@@ -543,8 +565,8 @@ WindowManagerState* WindowServer::GetWindowManagerStateForUser( |
user_id); |
} |
-ui::SurfacesState* WindowServer::GetSurfacesState() { |
- return surfaces_state_.get(); |
+ui::surfaces::DisplayCompositor* WindowServer::GetDisplayCompositor() { |
+ return display_compositor_.get(); |
} |
bool WindowServer::GetFrameDecorationsForUser( |
@@ -560,6 +582,16 @@ bool WindowServer::GetFrameDecorationsForUser( |
return window_manager_state->got_frame_decoration_values(); |
} |
+void WindowServer::OnSurfaceCreated(const gfx::Size& size, |
+ float device_scale_factor, |
+ const cc::SurfaceId& surface_id) { |
+ WindowId window_id(surface_id.client_id(), surface_id.sink_id()); |
+ ServerWindow* window = GetWindow(window_id); |
+ if (!window) |
+ return; |
+ ProcessWindowSurfaceCreated(window, size, device_scale_factor, surface_id); |
+} |
+ |
bool WindowServer::GetAndClearInFlightWindowManagerChange( |
uint32_t window_manager_change_id, |
InFlightWindowManagerChange* change) { |