Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: services/ui/ws/window_server.cc

Issue 2617403003: Mus: Remove CompositorFrameSinkType (Closed)
Patch Set: Fix some unit tests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 768
769 void WindowServer::OnGpuServiceInitialized() { 769 void WindowServer::OnGpuServiceInitialized() {
770 // TODO(kylechar): When gpu channel is removed, this can instead happen 770 // TODO(kylechar): When gpu channel is removed, this can instead happen
771 // earlier, after GpuHost::OnInitialized(). 771 // earlier, after GpuHost::OnInitialized().
772 delegate_->StartDisplayInit(); 772 delegate_->StartDisplayInit();
773 } 773 }
774 774
775 void WindowServer::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) { 775 void WindowServer::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) {
776 WindowId window_id( 776 WindowId window_id(
777 WindowIdFromTransportId(surface_info.id().frame_sink_id().client_id())); 777 WindowIdFromTransportId(surface_info.id().frame_sink_id().client_id()));
778 mojom::CompositorFrameSinkType compositor_frame_sink_type(
779 static_cast<mojom::CompositorFrameSinkType>(
780 surface_info.id().frame_sink_id().sink_id()));
781 ServerWindow* window = GetWindow(window_id); 778 ServerWindow* window = GetWindow(window_id);
782 // If the window doesn't have a parent then we have nothing to propagate. 779 // If the window doesn't have a parent then we have nothing to propagate.
783 if (!window) 780 if (!window)
784 return; 781 return;
785 782
786 // Cache the last submitted surface ID in the window server. 783 // Cache the last submitted surface ID in the window server.
787 // DisplayCompositorFrameSink may submit a CompositorFrame without 784 // DisplayCompositorFrameSink may submit a CompositorFrame without
788 // creating a CompositorFrameSinkManager. 785 // creating a CompositorFrameSinkManager.
789 window->GetOrCreateCompositorFrameSinkManager()->SetLatestSurfaceInfo( 786 window->GetOrCreateCompositorFrameSinkManager()->SetLatestSurfaceInfo(
790 compositor_frame_sink_type, surface_info); 787 surface_info);
791 788
792 // FrameGenerator will add an appropriate reference for the new surface. 789 // FrameGenerator will add an appropriate reference for the new surface.
793 DCHECK(display_manager_->GetDisplayContaining(window)); 790 DCHECK(display_manager_->GetDisplayContaining(window));
794 display_manager_->GetDisplayContaining(window) 791 display_manager_->GetDisplayContaining(window)
795 ->platform_display() 792 ->platform_display()
796 ->GetFrameGenerator() 793 ->GetFrameGenerator()
797 ->OnSurfaceCreated(surface_info.id(), window); 794 ->OnSurfaceCreated(surface_info.id(), window);
798 795
799 // This is only used for testing to observe that a window has a 796 // This is only used for testing to observe that a window has a
800 // CompositorFrame. 797 // CompositorFrame.
801 if (!window_paint_callback_.is_null()) 798 if (!window_paint_callback_.is_null())
802 window_paint_callback_.Run(window); 799 window_paint_callback_.Run(window);
803 800
804 // We only care about propagating default surface IDs. 801 if (!window->parent())
805 // TODO(fsamuel, sadrul): we should get rid of CompositorFrameSinkTypes.
806 if (compositor_frame_sink_type != mojom::CompositorFrameSinkType::DEFAULT ||
807 !window->parent()) {
808 return; 802 return;
809 } 803
810 WindowTree* window_tree = GetTreeWithId(window->parent()->id().client_id); 804 WindowTree* window_tree = GetTreeWithId(window->parent()->id().client_id);
811 if (window_tree) 805 if (window_tree)
812 window_tree->ProcessWindowSurfaceChanged(window, surface_info); 806 window_tree->ProcessWindowSurfaceChanged(window, surface_info);
813 } 807 }
814 808
815 void WindowServer::OnDisplayCompositorCreated( 809 void WindowServer::OnDisplayCompositorCreated(
816 const cc::SurfaceId& root_surface_id) { 810 const cc::SurfaceId& root_surface_id) {
817 root_surface_id_ = root_surface_id; 811 root_surface_id_ = root_surface_id;
818 } 812 }
819 813
820 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id, 814 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id,
821 const UserId& active_id) { 815 const UserId& active_id) {
822 } 816 }
823 817
824 void WindowServer::OnUserIdAdded(const UserId& id) { 818 void WindowServer::OnUserIdAdded(const UserId& id) {
825 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); 819 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr);
826 } 820 }
827 821
828 void WindowServer::OnUserIdRemoved(const UserId& id) { 822 void WindowServer::OnUserIdRemoved(const UserId& id) {
829 activity_monitor_map_.erase(id); 823 activity_monitor_map_.erase(id);
830 } 824 }
831 825
832 } // namespace ws 826 } // namespace ws
833 } // namespace ui 827 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_manager_access_policy.cc ('k') | services/ui/ws/window_server_test_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698