| 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 #include "services/ui/ws/window_server.h" | 5 #include "services/ui/ws/window_server.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "services/service_manager/public/cpp/connection.h" | 13 #include "services/service_manager/public/cpp/connection.h" |
| 14 #include "services/ui/ws/display.h" | 14 #include "services/ui/ws/display.h" |
| 15 #include "services/ui/ws/display_manager.h" | 15 #include "services/ui/ws/display_manager.h" |
| 16 #include "services/ui/ws/frame_generator.h" | 16 #include "services/ui/ws/frame_generator.h" |
| 17 #include "services/ui/ws/gpu_service_proxy.h" | 17 #include "services/ui/ws/gpu_host.h" |
| 18 #include "services/ui/ws/operation.h" | 18 #include "services/ui/ws/operation.h" |
| 19 #include "services/ui/ws/server_window.h" | 19 #include "services/ui/ws/server_window.h" |
| 20 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" | 20 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" |
| 21 #include "services/ui/ws/user_activity_monitor.h" | 21 #include "services/ui/ws/user_activity_monitor.h" |
| 22 #include "services/ui/ws/window_coordinate_conversions.h" | 22 #include "services/ui/ws/window_coordinate_conversions.h" |
| 23 #include "services/ui/ws/window_manager_access_policy.h" | 23 #include "services/ui/ws/window_manager_access_policy.h" |
| 24 #include "services/ui/ws/window_manager_display_root.h" | 24 #include "services/ui/ws/window_manager_display_root.h" |
| 25 #include "services/ui/ws/window_manager_state.h" | 25 #include "services/ui/ws/window_manager_state.h" |
| 26 #include "services/ui/ws/window_manager_window_tree_factory.h" | 26 #include "services/ui/ws/window_manager_window_tree_factory.h" |
| 27 #include "services/ui/ws/window_server_delegate.h" | 27 #include "services/ui/ws/window_server_delegate.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 gfx::Rect revert_bounds; | 39 gfx::Rect revert_bounds; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 struct WindowServer::CurrentDragLoopState { | 42 struct WindowServer::CurrentDragLoopState { |
| 43 uint32_t change_id; | 43 uint32_t change_id; |
| 44 ServerWindow* window; | 44 ServerWindow* window; |
| 45 WindowTree* initiator; | 45 WindowTree* initiator; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // TODO(fsamuel): DisplayCompositor should be a mojo interface dispensed by | 48 // TODO(fsamuel): DisplayCompositor should be a mojo interface dispensed by |
| 49 // GpuServiceProxy. | 49 // GpuHost. |
| 50 WindowServer::WindowServer(WindowServerDelegate* delegate) | 50 WindowServer::WindowServer(WindowServerDelegate* delegate) |
| 51 : delegate_(delegate), | 51 : delegate_(delegate), |
| 52 next_client_id_(1), | 52 next_client_id_(1), |
| 53 display_manager_(new DisplayManager(this, &user_id_tracker_)), | 53 display_manager_(new DisplayManager(this, &user_id_tracker_)), |
| 54 current_operation_(nullptr), | 54 current_operation_(nullptr), |
| 55 in_destructor_(false), | 55 in_destructor_(false), |
| 56 next_wm_change_id_(0), | 56 next_wm_change_id_(0), |
| 57 gpu_proxy_(new GpuServiceProxy(this)), | 57 gpu_host_(new GpuHost(this)), |
| 58 window_manager_window_tree_factory_set_(this, &user_id_tracker_), | 58 window_manager_window_tree_factory_set_(this, &user_id_tracker_), |
| 59 display_compositor_client_binding_(this) { | 59 display_compositor_client_binding_(this) { |
| 60 user_id_tracker_.AddObserver(this); | 60 user_id_tracker_.AddObserver(this); |
| 61 OnUserIdAdded(user_id_tracker_.active_id()); | 61 OnUserIdAdded(user_id_tracker_.active_id()); |
| 62 gpu_proxy_->CreateDisplayCompositor( | 62 gpu_host_->CreateDisplayCompositor( |
| 63 mojo::GetProxy(&display_compositor_), | 63 mojo::GetProxy(&display_compositor_), |
| 64 display_compositor_client_binding_.CreateInterfacePtrAndBind()); | 64 display_compositor_client_binding_.CreateInterfacePtrAndBind()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 WindowServer::~WindowServer() { | 67 WindowServer::~WindowServer() { |
| 68 in_destructor_ = true; | 68 in_destructor_ = true; |
| 69 | 69 |
| 70 for (auto& pair : tree_map_) | 70 for (auto& pair : tree_map_) |
| 71 pair.second->PrepareForWindowServerShutdown(); | 71 pair.second->PrepareForWindowServerShutdown(); |
| 72 | 72 |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 if (current_operation_type() == OperationType::DELETE_WINDOW) | 754 if (current_operation_type() == OperationType::DELETE_WINDOW) |
| 755 return; | 755 return; |
| 756 for (auto& pair : tree_map_) { | 756 for (auto& pair : tree_map_) { |
| 757 pair.second->ProcessTransientWindowRemoved(window, transient_child, | 757 pair.second->ProcessTransientWindowRemoved(window, transient_child, |
| 758 IsOperationSource(pair.first)); | 758 IsOperationSource(pair.first)); |
| 759 } | 759 } |
| 760 } | 760 } |
| 761 | 761 |
| 762 void WindowServer::OnGpuServiceInitialized() { | 762 void WindowServer::OnGpuServiceInitialized() { |
| 763 // TODO(kylechar): When gpu channel is removed, this can instead happen | 763 // TODO(kylechar): When gpu channel is removed, this can instead happen |
| 764 // earlier, after GpuServiceProxy::OnInitialized(). | 764 // earlier, after GpuHost::OnInitialized(). |
| 765 delegate_->StartDisplayInit(); | 765 delegate_->StartDisplayInit(); |
| 766 } | 766 } |
| 767 | 767 |
| 768 void WindowServer::OnSurfaceCreated(const cc::SurfaceId& surface_id, | 768 void WindowServer::OnSurfaceCreated(const cc::SurfaceId& surface_id, |
| 769 const gfx::Size& frame_size, | 769 const gfx::Size& frame_size, |
| 770 float device_scale_factor) { | 770 float device_scale_factor) { |
| 771 WindowId window_id( | 771 WindowId window_id( |
| 772 WindowIdFromTransportId(surface_id.frame_sink_id().client_id())); | 772 WindowIdFromTransportId(surface_id.frame_sink_id().client_id())); |
| 773 mojom::CompositorFrameSinkType compositor_frame_sink_type( | 773 mojom::CompositorFrameSinkType compositor_frame_sink_type( |
| 774 static_cast<mojom::CompositorFrameSinkType>( | 774 static_cast<mojom::CompositorFrameSinkType>( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 void WindowServer::OnUserIdAdded(const UserId& id) { | 821 void WindowServer::OnUserIdAdded(const UserId& id) { |
| 822 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 822 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
| 823 } | 823 } |
| 824 | 824 |
| 825 void WindowServer::OnUserIdRemoved(const UserId& id) { | 825 void WindowServer::OnUserIdRemoved(const UserId& id) { |
| 826 activity_monitor_map_.erase(id); | 826 activity_monitor_map_.erase(id); |
| 827 } | 827 } |
| 828 | 828 |
| 829 } // namespace ws | 829 } // namespace ws |
| 830 } // namespace ui | 830 } // namespace ui |
| OLD | NEW |