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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_proxy_(new GpuServiceProxy(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 display_compositor_request_ = mojo::GetProxy(&display_compositor_); | 62 gpu_proxy_->CreateDisplayCompositor( |
| 63 mojo::GetProxy(&display_compositor_), |
| 64 display_compositor_client_binding_.CreateInterfacePtrAndBind()); |
63 } | 65 } |
64 | 66 |
65 WindowServer::~WindowServer() { | 67 WindowServer::~WindowServer() { |
66 in_destructor_ = true; | 68 in_destructor_ = true; |
67 | 69 |
68 for (auto& pair : tree_map_) | 70 for (auto& pair : tree_map_) |
69 pair.second->PrepareForWindowServerShutdown(); | 71 pair.second->PrepareForWindowServerShutdown(); |
70 | 72 |
71 // Destroys the window trees results in querying for the display. Tear down | 73 // Destroys the window trees results in querying for the display. Tear down |
72 // the displays first so that the trees are notified of the display going | 74 // the displays first so that the trees are notified of the display going |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // If we're deleting a window, then this is a superfluous message. | 738 // If we're deleting a window, then this is a superfluous message. |
737 if (current_operation_type() == OperationType::DELETE_WINDOW) | 739 if (current_operation_type() == OperationType::DELETE_WINDOW) |
738 return; | 740 return; |
739 for (auto& pair : tree_map_) { | 741 for (auto& pair : tree_map_) { |
740 pair.second->ProcessTransientWindowRemoved(window, transient_child, | 742 pair.second->ProcessTransientWindowRemoved(window, transient_child, |
741 IsOperationSource(pair.first)); | 743 IsOperationSource(pair.first)); |
742 } | 744 } |
743 } | 745 } |
744 | 746 |
745 void WindowServer::OnGpuServiceInitialized() { | 747 void WindowServer::OnGpuServiceInitialized() { |
746 // TODO(fsamuel): Currently we: 1. create the gpu service, 2. we initialize | |
747 // GL and then 3. we request a display compositor interface after | |
748 // initialization. A display compositor interface can be created at any time, | |
749 // even prior to completing initialization. If initialization crashes the GPU | |
750 // process, then we will still get a connection error on the | |
751 // |display_compositor_client_binding_| binding. We should investigate doing | |
752 // this in parallel with initialization in the future. | |
753 // The display compositor gets its own thread in mus-gpu. The gpu service, | |
754 // where GL commands are processed resides on its own thread. Various | |
755 // components of the display compositor such as Display, ResourceProvider, | |
756 // and GLRenderer block on sync tokens from other command buffers. Thus, | |
757 // the gpu service must live on a separate thread. | |
758 gpu_proxy_->CreateDisplayCompositor( | |
759 std::move(display_compositor_request_), | |
760 display_compositor_client_binding_.CreateInterfacePtrAndBind()); | |
761 // TODO(kylechar): When gpu channel is removed, this can instead happen | 748 // TODO(kylechar): When gpu channel is removed, this can instead happen |
762 // earlier, after GpuServiceProxy::OnInitialized(). | 749 // earlier, after GpuServiceProxy::OnInitialized(). |
763 delegate_->StartDisplayInit(); | 750 delegate_->StartDisplayInit(); |
764 } | 751 } |
765 | 752 |
766 void WindowServer::OnSurfaceCreated(const cc::SurfaceId& surface_id, | 753 void WindowServer::OnSurfaceCreated(const cc::SurfaceId& surface_id, |
767 const gfx::Size& frame_size, | 754 const gfx::Size& frame_size, |
768 float device_scale_factor) { | 755 float device_scale_factor) { |
769 WindowId window_id( | 756 WindowId window_id( |
770 WindowIdFromTransportId(surface_id.frame_sink_id().client_id())); | 757 WindowIdFromTransportId(surface_id.frame_sink_id().client_id())); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 void WindowServer::OnUserIdAdded(const UserId& id) { | 801 void WindowServer::OnUserIdAdded(const UserId& id) { |
815 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 802 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
816 } | 803 } |
817 | 804 |
818 void WindowServer::OnUserIdRemoved(const UserId& id) { | 805 void WindowServer::OnUserIdRemoved(const UserId& id) { |
819 activity_monitor_map_.erase(id); | 806 activity_monitor_map_.erase(id); |
820 } | 807 } |
821 | 808 |
822 } // namespace ws | 809 } // namespace ws |
823 } // namespace ui | 810 } // namespace ui |
OLD | NEW |