OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SERVICES_UI_WS_WINDOW_SERVER_H_ | 5 #ifndef SERVICES_UI_WS_WINDOW_SERVER_H_ |
6 #define SERVICES_UI_WS_WINDOW_SERVER_H_ | 6 #define SERVICES_UI_WS_WINDOW_SERVER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/optional.h" | 16 #include "base/optional.h" |
17 #include "mojo/public/cpp/bindings/array.h" | 17 #include "mojo/public/cpp/bindings/array.h" |
18 #include "mojo/public/cpp/bindings/binding.h" | 18 #include "mojo/public/cpp/bindings/binding.h" |
19 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom
.h" | 19 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom
.h" |
20 #include "services/ui/public/interfaces/window_tree.mojom.h" | 20 #include "services/ui/public/interfaces/window_tree.mojom.h" |
21 #include "services/ui/public/interfaces/window_tree_host.mojom.h" | 21 #include "services/ui/public/interfaces/window_tree_host.mojom.h" |
22 #include "services/ui/surfaces/surfaces_state.h" | 22 #include "services/ui/surfaces/display_compositor.h" |
| 23 #include "services/ui/surfaces/display_compositor_client.h" |
23 #include "services/ui/ws/display.h" | 24 #include "services/ui/ws/display.h" |
24 #include "services/ui/ws/gpu_service_proxy_delegate.h" | 25 #include "services/ui/ws/gpu_service_proxy_delegate.h" |
25 #include "services/ui/ws/ids.h" | 26 #include "services/ui/ws/ids.h" |
26 #include "services/ui/ws/operation.h" | 27 #include "services/ui/ws/operation.h" |
27 #include "services/ui/ws/server_window_delegate.h" | 28 #include "services/ui/ws/server_window_delegate.h" |
28 #include "services/ui/ws/server_window_observer.h" | 29 #include "services/ui/ws/server_window_observer.h" |
29 #include "services/ui/ws/user_display_manager_delegate.h" | 30 #include "services/ui/ws/user_display_manager_delegate.h" |
30 #include "services/ui/ws/user_id_tracker.h" | 31 #include "services/ui/ws/user_id_tracker.h" |
31 #include "services/ui/ws/user_id_tracker_observer.h" | 32 #include "services/ui/ws/user_id_tracker_observer.h" |
32 #include "services/ui/ws/window_manager_window_tree_factory_set.h" | 33 #include "services/ui/ws/window_manager_window_tree_factory_set.h" |
33 | 34 |
34 namespace ui { | 35 namespace ui { |
35 namespace ws { | 36 namespace ws { |
36 | 37 |
37 class AccessPolicy; | 38 class AccessPolicy; |
38 class DisplayManager; | 39 class DisplayManager; |
39 class GpuServiceProxy; | 40 class GpuServiceProxy; |
40 class ServerWindow; | 41 class ServerWindow; |
41 class UserActivityMonitor; | 42 class UserActivityMonitor; |
42 class WindowManagerState; | 43 class WindowManagerState; |
43 class WindowServerDelegate; | 44 class WindowServerDelegate; |
44 class WindowTree; | 45 class WindowTree; |
45 class WindowTreeBinding; | 46 class WindowTreeBinding; |
46 | 47 |
47 // WindowServer manages the set of clients of the window server (all the | 48 // WindowServer manages the set of clients of the window server (all the |
48 // WindowTrees) as well as providing the root of the hierarchy. | 49 // WindowTrees) as well as providing the root of the hierarchy. |
49 class WindowServer : public ServerWindowDelegate, | 50 class WindowServer : public ServerWindowDelegate, |
50 public ServerWindowObserver, | 51 public ServerWindowObserver, |
| 52 public surfaces::DisplayCompositorClient, |
51 public GpuServiceProxyDelegate, | 53 public GpuServiceProxyDelegate, |
52 public UserDisplayManagerDelegate, | 54 public UserDisplayManagerDelegate, |
53 public UserIdTrackerObserver { | 55 public UserIdTrackerObserver { |
54 public: | 56 public: |
55 explicit WindowServer(WindowServerDelegate* delegate); | 57 explicit WindowServer(WindowServerDelegate* delegate); |
56 ~WindowServer() override; | 58 ~WindowServer() override; |
57 | 59 |
58 WindowServerDelegate* delegate() { return delegate_; } | 60 WindowServerDelegate* delegate() { return delegate_; } |
59 | 61 |
60 UserIdTracker* user_id_tracker() { return &user_id_tracker_; } | 62 UserIdTracker* user_id_tracker() { return &user_id_tracker_; } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 171 |
170 // Called when we get an unexpected message from the WindowManager. | 172 // Called when we get an unexpected message from the WindowManager. |
171 // TODO(sky): decide what we want to do here. | 173 // TODO(sky): decide what we want to do here. |
172 void WindowManagerSentBogusMessage() {} | 174 void WindowManagerSentBogusMessage() {} |
173 | 175 |
174 // These functions trivially delegate to all WindowTrees, which in | 176 // These functions trivially delegate to all WindowTrees, which in |
175 // term notify their clients. | 177 // term notify their clients. |
176 void ProcessWindowBoundsChanged(const ServerWindow* window, | 178 void ProcessWindowBoundsChanged(const ServerWindow* window, |
177 const gfx::Rect& old_bounds, | 179 const gfx::Rect& old_bounds, |
178 const gfx::Rect& new_bounds); | 180 const gfx::Rect& new_bounds); |
| 181 void ProcessWindowSurfaceCreated(ServerWindow* window, |
| 182 const gfx::Size& size, |
| 183 float device_scale_factor, |
| 184 const cc::SurfaceId& surface_id); |
179 void ProcessClientAreaChanged( | 185 void ProcessClientAreaChanged( |
180 const ServerWindow* window, | 186 const ServerWindow* window, |
181 const gfx::Insets& new_client_area, | 187 const gfx::Insets& new_client_area, |
182 const std::vector<gfx::Rect>& new_additional_client_areas); | 188 const std::vector<gfx::Rect>& new_additional_client_areas); |
183 void ProcessCaptureChanged(const ServerWindow* new_capture, | 189 void ProcessCaptureChanged(const ServerWindow* new_capture, |
184 const ServerWindow* old_capture); | 190 const ServerWindow* old_capture); |
185 void ProcessWillChangeWindowHierarchy(const ServerWindow* window, | 191 void ProcessWillChangeWindowHierarchy(const ServerWindow* window, |
186 const ServerWindow* new_parent, | 192 const ServerWindow* new_parent, |
187 const ServerWindow* old_parent); | 193 const ServerWindow* old_parent); |
188 void ProcessWindowHierarchyChanged(const ServerWindow* window, | 194 void ProcessWindowHierarchyChanged(const ServerWindow* window, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 uint32_t GetCurrentDragLoopChangeId(); | 231 uint32_t GetCurrentDragLoopChangeId(); |
226 ServerWindow* GetCurrentDragLoopWindow(); | 232 ServerWindow* GetCurrentDragLoopWindow(); |
227 WindowTree* GetCurrentDragLoopInitiator(); | 233 WindowTree* GetCurrentDragLoopInitiator(); |
228 bool in_drag_loop() const { return !!current_drag_loop_; } | 234 bool in_drag_loop() const { return !!current_drag_loop_; } |
229 | 235 |
230 void OnDisplayReady(Display* display, bool is_first); | 236 void OnDisplayReady(Display* display, bool is_first); |
231 void OnNoMoreDisplays(); | 237 void OnNoMoreDisplays(); |
232 WindowManagerState* GetWindowManagerStateForUser(const UserId& user_id); | 238 WindowManagerState* GetWindowManagerStateForUser(const UserId& user_id); |
233 | 239 |
234 // ServerWindowDelegate: | 240 // ServerWindowDelegate: |
235 ui::SurfacesState* GetSurfacesState() override; | 241 ui::surfaces::DisplayCompositor* GetDisplayCompositor() override; |
236 | 242 |
237 // UserDisplayManagerDelegate: | 243 // UserDisplayManagerDelegate: |
238 bool GetFrameDecorationsForUser( | 244 bool GetFrameDecorationsForUser( |
239 const UserId& user_id, | 245 const UserId& user_id, |
240 mojom::FrameDecorationValuesPtr* values) override; | 246 mojom::FrameDecorationValuesPtr* values) override; |
241 | 247 |
242 private: | 248 private: |
243 struct CurrentMoveLoopState; | 249 struct CurrentMoveLoopState; |
244 struct CurrentDragLoopState; | 250 struct CurrentDragLoopState; |
245 friend class Operation; | 251 friend class Operation; |
246 | 252 |
247 using WindowTreeMap = | 253 using WindowTreeMap = |
248 std::map<ClientSpecificId, std::unique_ptr<WindowTree>>; | 254 std::map<ClientSpecificId, std::unique_ptr<WindowTree>>; |
249 using UserActivityMonitorMap = | 255 using UserActivityMonitorMap = |
250 std::map<UserId, std::unique_ptr<UserActivityMonitor>>; | 256 std::map<UserId, std::unique_ptr<UserActivityMonitor>>; |
251 | 257 |
252 struct InFlightWindowManagerChange { | 258 struct InFlightWindowManagerChange { |
253 // Identifies the client that initiated the change. | 259 // Identifies the client that initiated the change. |
254 ClientSpecificId client_id; | 260 ClientSpecificId client_id; |
255 | 261 |
256 // Change id supplied by the client. | 262 // Change id supplied by the client. |
257 uint32_t client_change_id; | 263 uint32_t client_change_id; |
258 }; | 264 }; |
259 | 265 |
| 266 // DisplayCompositorClient implementation: |
| 267 void OnSurfaceCreated(const gfx::Size& size, |
| 268 float device_scale_factor, |
| 269 const cc::SurfaceId& surface_id) override; |
| 270 |
260 using InFlightWindowManagerChangeMap = | 271 using InFlightWindowManagerChangeMap = |
261 std::map<uint32_t, InFlightWindowManagerChange>; | 272 std::map<uint32_t, InFlightWindowManagerChange>; |
262 | 273 |
263 bool GetAndClearInFlightWindowManagerChange( | 274 bool GetAndClearInFlightWindowManagerChange( |
264 uint32_t window_manager_change_id, | 275 uint32_t window_manager_change_id, |
265 InFlightWindowManagerChange* change); | 276 InFlightWindowManagerChange* change); |
266 | 277 |
267 // Invoked when a client is about to execute a window server operation. | 278 // Invoked when a client is about to execute a window server operation. |
268 // Subsequently followed by FinishOperation() once the change is done. | 279 // Subsequently followed by FinishOperation() once the change is done. |
269 // | 280 // |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 void OnActiveUserIdChanged(const UserId& previously_active_id, | 349 void OnActiveUserIdChanged(const UserId& previously_active_id, |
339 const UserId& active_id) override; | 350 const UserId& active_id) override; |
340 void OnUserIdAdded(const UserId& id) override; | 351 void OnUserIdAdded(const UserId& id) override; |
341 void OnUserIdRemoved(const UserId& id) override; | 352 void OnUserIdRemoved(const UserId& id) override; |
342 | 353 |
343 UserIdTracker user_id_tracker_; | 354 UserIdTracker user_id_tracker_; |
344 | 355 |
345 WindowServerDelegate* delegate_; | 356 WindowServerDelegate* delegate_; |
346 | 357 |
347 // State for rendering into a Surface. | 358 // State for rendering into a Surface. |
348 scoped_refptr<ui::SurfacesState> surfaces_state_; | 359 scoped_refptr<ui::surfaces::DisplayCompositor> display_compositor_; |
349 | 360 |
350 // ID to use for next WindowTree. | 361 // ID to use for next WindowTree. |
351 ClientSpecificId next_client_id_; | 362 ClientSpecificId next_client_id_; |
352 | 363 |
353 std::unique_ptr<DisplayManager> display_manager_; | 364 std::unique_ptr<DisplayManager> display_manager_; |
354 | 365 |
355 std::unique_ptr<CurrentDragLoopState> current_drag_loop_; | 366 std::unique_ptr<CurrentDragLoopState> current_drag_loop_; |
356 std::unique_ptr<CurrentMoveLoopState> current_move_loop_; | 367 std::unique_ptr<CurrentMoveLoopState> current_move_loop_; |
357 | 368 |
358 // Set of WindowTrees. | 369 // Set of WindowTrees. |
(...skipping 21 matching lines...) Expand all Loading... |
380 | 391 |
381 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_; | 392 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_; |
382 | 393 |
383 DISALLOW_COPY_AND_ASSIGN(WindowServer); | 394 DISALLOW_COPY_AND_ASSIGN(WindowServer); |
384 }; | 395 }; |
385 | 396 |
386 } // namespace ws | 397 } // namespace ws |
387 } // namespace ui | 398 } // namespace ui |
388 | 399 |
389 #endif // SERVICES_UI_WS_WINDOW_SERVER_H_ | 400 #endif // SERVICES_UI_WS_WINDOW_SERVER_H_ |
OLD | NEW |