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/shell/public/cpp/connection.h" | 13 #include "services/shell/public/cpp/connection.h" |
14 #include "services/ui/ws/display.h" | 14 #include "services/ui/ws/display.h" |
15 #include "services/ui/ws/display_binding.h" | 15 #include "services/ui/ws/display_binding.h" |
16 #include "services/ui/ws/display_manager.h" | 16 #include "services/ui/ws/display_manager.h" |
| 17 #include "services/ui/ws/gpu_service_proxy.h" |
17 #include "services/ui/ws/operation.h" | 18 #include "services/ui/ws/operation.h" |
18 #include "services/ui/ws/server_window.h" | 19 #include "services/ui/ws/server_window.h" |
19 #include "services/ui/ws/user_activity_monitor.h" | 20 #include "services/ui/ws/user_activity_monitor.h" |
20 #include "services/ui/ws/window_coordinate_conversions.h" | 21 #include "services/ui/ws/window_coordinate_conversions.h" |
21 #include "services/ui/ws/window_manager_access_policy.h" | 22 #include "services/ui/ws/window_manager_access_policy.h" |
22 #include "services/ui/ws/window_manager_display_root.h" | 23 #include "services/ui/ws/window_manager_display_root.h" |
23 #include "services/ui/ws/window_manager_state.h" | 24 #include "services/ui/ws/window_manager_state.h" |
24 #include "services/ui/ws/window_manager_window_tree_factory.h" | 25 #include "services/ui/ws/window_manager_window_tree_factory.h" |
25 #include "services/ui/ws/window_server_delegate.h" | 26 #include "services/ui/ws/window_server_delegate.h" |
26 #include "services/ui/ws/window_tree.h" | 27 #include "services/ui/ws/window_tree.h" |
(...skipping 11 matching lines...) Expand all Loading... |
38 }; | 39 }; |
39 | 40 |
40 WindowServer::WindowServer(WindowServerDelegate* delegate) | 41 WindowServer::WindowServer(WindowServerDelegate* delegate) |
41 : delegate_(delegate), | 42 : delegate_(delegate), |
42 surfaces_state_(new SurfacesState()), | 43 surfaces_state_(new SurfacesState()), |
43 next_client_id_(1), | 44 next_client_id_(1), |
44 display_manager_(new DisplayManager(this, &user_id_tracker_)), | 45 display_manager_(new DisplayManager(this, &user_id_tracker_)), |
45 current_operation_(nullptr), | 46 current_operation_(nullptr), |
46 in_destructor_(false), | 47 in_destructor_(false), |
47 next_wm_change_id_(0), | 48 next_wm_change_id_(0), |
| 49 gpu_proxy_(new GpuServiceProxy(this)), |
48 window_manager_window_tree_factory_set_(this, &user_id_tracker_) { | 50 window_manager_window_tree_factory_set_(this, &user_id_tracker_) { |
49 user_id_tracker_.AddObserver(this); | 51 user_id_tracker_.AddObserver(this); |
50 OnUserIdAdded(user_id_tracker_.active_id()); | 52 OnUserIdAdded(user_id_tracker_.active_id()); |
51 } | 53 } |
52 | 54 |
53 WindowServer::~WindowServer() { | 55 WindowServer::~WindowServer() { |
54 in_destructor_ = true; | 56 in_destructor_ = true; |
55 | 57 |
56 // Destroys the window trees results in querying for the display. Tear down | 58 // Destroys the window trees results in querying for the display. Tear down |
57 // the displays first so that the trees are notified of the display going | 59 // the displays first so that the trees are notified of the display going |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 ServerWindow* transient_child) { | 759 ServerWindow* transient_child) { |
758 // If we're deleting a window, then this is a superfluous message. | 760 // If we're deleting a window, then this is a superfluous message. |
759 if (current_operation_type() == OperationType::DELETE_WINDOW) | 761 if (current_operation_type() == OperationType::DELETE_WINDOW) |
760 return; | 762 return; |
761 for (auto& pair : tree_map_) { | 763 for (auto& pair : tree_map_) { |
762 pair.second->ProcessTransientWindowRemoved(window, transient_child, | 764 pair.second->ProcessTransientWindowRemoved(window, transient_child, |
763 IsOperationSource(pair.first)); | 765 IsOperationSource(pair.first)); |
764 } | 766 } |
765 } | 767 } |
766 | 768 |
| 769 void WindowServer::OnGpuChannelEstablished( |
| 770 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { |
| 771 const std::set<Display*>& displays = display_manager()->displays(); |
| 772 for (auto* display : displays) |
| 773 display->platform_display()->OnGpuChannelEstablished(gpu_channel); |
| 774 } |
| 775 |
767 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id, | 776 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id, |
768 const UserId& active_id) { | 777 const UserId& active_id) { |
769 if (IsUserInHighContrastMode(previously_active_id) == | 778 if (IsUserInHighContrastMode(previously_active_id) == |
770 IsUserInHighContrastMode(active_id)) | 779 IsUserInHighContrastMode(active_id)) |
771 return; | 780 return; |
772 for (Display* display : display_manager_->displays()) { | 781 for (Display* display : display_manager_->displays()) { |
773 display->SchedulePaint(display->root_window(), | 782 display->SchedulePaint(display->root_window(), |
774 gfx::Rect(display->root_window()->bounds().size())); | 783 gfx::Rect(display->root_window()->bounds().size())); |
775 } | 784 } |
776 } | 785 } |
777 | 786 |
778 void WindowServer::OnUserIdAdded(const UserId& id) { | 787 void WindowServer::OnUserIdAdded(const UserId& id) { |
779 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 788 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
780 clipboard_map_[id] = base::MakeUnique<clipboard::ClipboardImpl>(); | 789 clipboard_map_[id] = base::MakeUnique<clipboard::ClipboardImpl>(); |
781 } | 790 } |
782 | 791 |
783 void WindowServer::OnUserIdRemoved(const UserId& id) { | 792 void WindowServer::OnUserIdRemoved(const UserId& id) { |
784 activity_monitor_map_.erase(id); | 793 activity_monitor_map_.erase(id); |
785 clipboard_map_.erase(id); | 794 clipboard_map_.erase(id); |
786 } | 795 } |
787 | 796 |
788 } // namespace ws | 797 } // namespace ws |
789 } // namespace ui | 798 } // namespace ui |
OLD | NEW |