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 // The display compositor gets its own thread in mus-gpu. The gpu service, |
63 // where GL commands are processed resides on its own thread. Various | |
64 // components of the display compositor such as Display, ResourceProvider, | |
65 // and GLRenderer block on sync tokens from other command buffers. Thus, | |
66 // the gpu service must live on a separate thread. | |
sadrul
2016/11/30 21:05:55
This comment should in gpu_main.cc, right? It seem
Fady Samuel
2016/11/30 22:53:20
Done.
| |
67 gpu_proxy_->CreateDisplayCompositor( | |
68 mojo::GetProxy(&display_compositor_), | |
69 display_compositor_client_binding_.CreateInterfacePtrAndBind()); | |
63 } | 70 } |
64 | 71 |
65 WindowServer::~WindowServer() { | 72 WindowServer::~WindowServer() { |
66 in_destructor_ = true; | 73 in_destructor_ = true; |
67 | 74 |
68 for (auto& pair : tree_map_) | 75 for (auto& pair : tree_map_) |
69 pair.second->PrepareForWindowServerShutdown(); | 76 pair.second->PrepareForWindowServerShutdown(); |
70 | 77 |
71 // Destroys the window trees results in querying for the display. Tear down | 78 // 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 | 79 // 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. | 743 // If we're deleting a window, then this is a superfluous message. |
737 if (current_operation_type() == OperationType::DELETE_WINDOW) | 744 if (current_operation_type() == OperationType::DELETE_WINDOW) |
738 return; | 745 return; |
739 for (auto& pair : tree_map_) { | 746 for (auto& pair : tree_map_) { |
740 pair.second->ProcessTransientWindowRemoved(window, transient_child, | 747 pair.second->ProcessTransientWindowRemoved(window, transient_child, |
741 IsOperationSource(pair.first)); | 748 IsOperationSource(pair.first)); |
742 } | 749 } |
743 } | 750 } |
744 | 751 |
745 void WindowServer::OnGpuServiceInitialized() { | 752 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 | 753 // TODO(kylechar): When gpu channel is removed, this can instead happen |
762 // earlier, after GpuServiceProxy::OnInitialized(). | 754 // earlier, after GpuServiceProxy::OnInitialized(). |
763 delegate_->StartDisplayInit(); | 755 delegate_->StartDisplayInit(); |
764 } | 756 } |
765 | 757 |
766 void WindowServer::OnSurfaceCreated(const cc::SurfaceId& surface_id, | 758 void WindowServer::OnSurfaceCreated(const cc::SurfaceId& surface_id, |
767 const gfx::Size& frame_size, | 759 const gfx::Size& frame_size, |
768 float device_scale_factor) { | 760 float device_scale_factor) { |
769 WindowId window_id( | 761 WindowId window_id( |
770 WindowIdFromTransportId(surface_id.frame_sink_id().client_id())); | 762 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) { | 806 void WindowServer::OnUserIdAdded(const UserId& id) { |
815 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 807 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
816 } | 808 } |
817 | 809 |
818 void WindowServer::OnUserIdRemoved(const UserId& id) { | 810 void WindowServer::OnUserIdRemoved(const UserId& id) { |
819 activity_monitor_map_.erase(id); | 811 activity_monitor_map_.erase(id); |
820 } | 812 } |
821 | 813 |
822 } // namespace ws | 814 } // namespace ws |
823 } // namespace ui | 815 } // namespace ui |
OLD | NEW |