| 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/gpu_service_proxy.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/server_window_compositor_frame_sink_manager.h" | 20 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" |
| 20 #include "services/ui/ws/user_activity_monitor.h" | 21 #include "services/ui/ws/user_activity_monitor.h" |
| 21 #include "services/ui/ws/window_coordinate_conversions.h" | 22 #include "services/ui/ws/window_coordinate_conversions.h" |
| 22 #include "services/ui/ws/window_manager_access_policy.h" | 23 #include "services/ui/ws/window_manager_access_policy.h" |
| 23 #include "services/ui/ws/window_manager_display_root.h" | 24 #include "services/ui/ws/window_manager_display_root.h" |
| 24 #include "services/ui/ws/window_manager_state.h" | 25 #include "services/ui/ws/window_manager_state.h" |
| 25 #include "services/ui/ws/window_manager_window_tree_factory.h" | 26 #include "services/ui/ws/window_manager_window_tree_factory.h" |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 // If the window doesn't have a parent then we have nothing to propagate. | 768 // If the window doesn't have a parent then we have nothing to propagate. |
| 768 if (!window) | 769 if (!window) |
| 769 return; | 770 return; |
| 770 | 771 |
| 771 // Cache the last submitted surface ID in the window server. | 772 // Cache the last submitted surface ID in the window server. |
| 772 // DisplayCompositorFrameSink may submit a CompositorFrame without | 773 // DisplayCompositorFrameSink may submit a CompositorFrame without |
| 773 // creating a CompositorFrameSinkManager. | 774 // creating a CompositorFrameSinkManager. |
| 774 window->GetOrCreateCompositorFrameSinkManager()->SetLatestSurfaceInfo( | 775 window->GetOrCreateCompositorFrameSinkManager()->SetLatestSurfaceInfo( |
| 775 compositor_frame_sink_type, surface_id, frame_size); | 776 compositor_frame_sink_type, surface_id, frame_size); |
| 776 | 777 |
| 778 // FrameGenerator will add an appropriate reference for the new surface. |
| 779 DCHECK(display_manager_->GetDisplayContaining(window)); |
| 780 display_manager_->GetDisplayContaining(window) |
| 781 ->platform_display() |
| 782 ->GetFrameGenerator() |
| 783 ->OnSurfaceCreated(surface_id, window); |
| 784 |
| 777 // This is only used for testing to observe that a window has a | 785 // This is only used for testing to observe that a window has a |
| 778 // CompositorFrame. | 786 // CompositorFrame. |
| 779 if (!window_paint_callback_.is_null()) | 787 if (!window_paint_callback_.is_null()) |
| 780 window_paint_callback_.Run(window); | 788 window_paint_callback_.Run(window); |
| 781 | 789 |
| 782 // We only care about propagating default surface IDs. | 790 // We only care about propagating default surface IDs. |
| 783 // TODO(fsamuel, sadrul): we should get rid of CompositorFrameSinkTypes. | 791 // TODO(fsamuel, sadrul): we should get rid of CompositorFrameSinkTypes. |
| 784 if (compositor_frame_sink_type != mojom::CompositorFrameSinkType::DEFAULT || | 792 if (compositor_frame_sink_type != mojom::CompositorFrameSinkType::DEFAULT || |
| 785 !window->parent()) { | 793 !window->parent()) { |
| 786 return; | 794 return; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 799 void WindowServer::OnUserIdAdded(const UserId& id) { | 807 void WindowServer::OnUserIdAdded(const UserId& id) { |
| 800 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 808 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
| 801 } | 809 } |
| 802 | 810 |
| 803 void WindowServer::OnUserIdRemoved(const UserId& id) { | 811 void WindowServer::OnUserIdRemoved(const UserId& id) { |
| 804 activity_monitor_map_.erase(id); | 812 activity_monitor_map_.erase(id); |
| 805 } | 813 } |
| 806 | 814 |
| 807 } // namespace ws | 815 } // namespace ws |
| 808 } // namespace ui | 816 } // namespace ui |
| OLD | NEW |