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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 GpuHost::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::SurfaceInfo& surface_info) { |
769 const gfx::Size& frame_size, | |
770 float device_scale_factor) { | |
771 WindowId window_id( | 769 WindowId window_id( |
772 WindowIdFromTransportId(surface_id.frame_sink_id().client_id())); | 770 WindowIdFromTransportId(surface_info.id().frame_sink_id().client_id())); |
773 mojom::CompositorFrameSinkType compositor_frame_sink_type( | 771 mojom::CompositorFrameSinkType compositor_frame_sink_type( |
774 static_cast<mojom::CompositorFrameSinkType>( | 772 static_cast<mojom::CompositorFrameSinkType>( |
775 surface_id.frame_sink_id().sink_id())); | 773 surface_info.id().frame_sink_id().sink_id())); |
776 ServerWindow* window = GetWindow(window_id); | 774 ServerWindow* window = GetWindow(window_id); |
777 // If the window doesn't have a parent then we have nothing to propagate. | 775 // If the window doesn't have a parent then we have nothing to propagate. |
778 if (!window) | 776 if (!window) |
779 return; | 777 return; |
780 | 778 |
781 // Cache the last submitted surface ID in the window server. | 779 // Cache the last submitted surface ID in the window server. |
782 // DisplayCompositorFrameSink may submit a CompositorFrame without | 780 // DisplayCompositorFrameSink may submit a CompositorFrame without |
783 // creating a CompositorFrameSinkManager. | 781 // creating a CompositorFrameSinkManager. |
784 window->GetOrCreateCompositorFrameSinkManager()->SetLatestSurfaceInfo( | 782 window->GetOrCreateCompositorFrameSinkManager()->SetLatestSurfaceInfo( |
785 compositor_frame_sink_type, surface_id, frame_size); | 783 compositor_frame_sink_type, surface_info); |
786 | 784 |
787 // FrameGenerator will add an appropriate reference for the new surface. | 785 // FrameGenerator will add an appropriate reference for the new surface. |
788 DCHECK(display_manager_->GetDisplayContaining(window)); | 786 DCHECK(display_manager_->GetDisplayContaining(window)); |
789 display_manager_->GetDisplayContaining(window) | 787 display_manager_->GetDisplayContaining(window) |
790 ->platform_display() | 788 ->platform_display() |
791 ->GetFrameGenerator() | 789 ->GetFrameGenerator() |
792 ->OnSurfaceCreated(surface_id, window); | 790 ->OnSurfaceCreated(surface_info.id(), window); |
793 | 791 |
794 // This is only used for testing to observe that a window has a | 792 // This is only used for testing to observe that a window has a |
795 // CompositorFrame. | 793 // CompositorFrame. |
796 if (!window_paint_callback_.is_null()) | 794 if (!window_paint_callback_.is_null()) |
797 window_paint_callback_.Run(window); | 795 window_paint_callback_.Run(window); |
798 | 796 |
799 // We only care about propagating default surface IDs. | 797 // We only care about propagating default surface IDs. |
800 // TODO(fsamuel, sadrul): we should get rid of CompositorFrameSinkTypes. | 798 // TODO(fsamuel, sadrul): we should get rid of CompositorFrameSinkTypes. |
801 if (compositor_frame_sink_type != mojom::CompositorFrameSinkType::DEFAULT || | 799 if (compositor_frame_sink_type != mojom::CompositorFrameSinkType::DEFAULT || |
802 !window->parent()) { | 800 !window->parent()) { |
803 return; | 801 return; |
804 } | 802 } |
805 WindowTree* window_tree = GetTreeWithId(window->parent()->id().client_id); | 803 WindowTree* window_tree = GetTreeWithId(window->parent()->id().client_id); |
806 if (window_tree) { | 804 if (window_tree) |
807 window_tree->ProcessWindowSurfaceChanged(window, surface_id, frame_size, | 805 window_tree->ProcessWindowSurfaceChanged(window, surface_info); |
808 device_scale_factor); | |
809 } | |
810 } | 806 } |
811 | 807 |
812 void WindowServer::OnDisplayCompositorCreated( | 808 void WindowServer::OnDisplayCompositorCreated( |
813 const cc::SurfaceId& root_surface_id) { | 809 const cc::SurfaceId& root_surface_id) { |
814 root_surface_id_ = root_surface_id; | 810 root_surface_id_ = root_surface_id; |
815 } | 811 } |
816 | 812 |
817 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id, | 813 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id, |
818 const UserId& active_id) { | 814 const UserId& active_id) { |
819 } | 815 } |
820 | 816 |
821 void WindowServer::OnUserIdAdded(const UserId& id) { | 817 void WindowServer::OnUserIdAdded(const UserId& id) { |
822 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 818 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
823 } | 819 } |
824 | 820 |
825 void WindowServer::OnUserIdRemoved(const UserId& id) { | 821 void WindowServer::OnUserIdRemoved(const UserId& id) { |
826 activity_monitor_map_.erase(id); | 822 activity_monitor_map_.erase(id); |
827 } | 823 } |
828 | 824 |
829 } // namespace ws | 825 } // namespace ws |
830 } // namespace ui | 826 } // namespace ui |
OLD | NEW |