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

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

Issue 2453013002: Mus: Remove dependency on ServerWindowCompositorFrameSink from FrameGenerator (Closed)
Patch Set: Rebased Created 4 years, 1 month 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"
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/gpu_service_proxy.h" 16 #include "services/ui/ws/gpu_service_proxy.h"
17 #include "services/ui/ws/operation.h" 17 #include "services/ui/ws/operation.h"
18 #include "services/ui/ws/server_window.h" 18 #include "services/ui/ws/server_window.h"
19 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h"
19 #include "services/ui/ws/user_activity_monitor.h" 20 #include "services/ui/ws/user_activity_monitor.h"
20 #include "services/ui/ws/window_coordinate_conversions.h" 21 #include "services/ui/ws/window_coordinate_conversions.h"
21 #include "services/ui/ws/window_manager_access_policy.h" 22 #include "services/ui/ws/window_manager_access_policy.h"
22 #include "services/ui/ws/window_manager_display_root.h" 23 #include "services/ui/ws/window_manager_display_root.h"
23 #include "services/ui/ws/window_manager_state.h" 24 #include "services/ui/ws/window_manager_state.h"
24 #include "services/ui/ws/window_manager_window_tree_factory.h" 25 #include "services/ui/ws/window_manager_window_tree_factory.h"
25 #include "services/ui/ws/window_server_delegate.h" 26 #include "services/ui/ws/window_server_delegate.h"
26 #include "services/ui/ws/window_tree.h" 27 #include "services/ui/ws/window_tree.h"
27 #include "services/ui/ws/window_tree_binding.h" 28 #include "services/ui/ws/window_tree_binding.h"
28 #include "ui/gfx/geometry/size_conversions.h" 29 #include "ui/gfx/geometry/size_conversions.h"
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 const std::set<Display*>& displays = display_manager()->displays(); 797 const std::set<Display*>& displays = display_manager()->displays();
797 for (auto* display : displays) 798 for (auto* display : displays)
798 display->platform_display()->OnGpuChannelEstablished(gpu_channel_); 799 display->platform_display()->OnGpuChannelEstablished(gpu_channel_);
799 } 800 }
800 801
801 void WindowServer::OnSurfaceCreated(const cc::SurfaceId& surface_id, 802 void WindowServer::OnSurfaceCreated(const cc::SurfaceId& surface_id,
802 const gfx::Size& frame_size, 803 const gfx::Size& frame_size,
803 float device_scale_factor) { 804 float device_scale_factor) {
804 WindowId window_id( 805 WindowId window_id(
805 WindowIdFromTransportId(surface_id.frame_sink_id().client_id())); 806 WindowIdFromTransportId(surface_id.frame_sink_id().client_id()));
806 mojom::CompositorFrameSinkType surface_type( 807 mojom::CompositorFrameSinkType compositor_frame_sink_type(
807 static_cast<mojom::CompositorFrameSinkType>( 808 static_cast<mojom::CompositorFrameSinkType>(
808 surface_id.frame_sink_id().sink_id())); 809 surface_id.frame_sink_id().sink_id()));
809 // We only care about propagating default surface IDs.
810 // TODO(fsamuel, sadrul): we should get rid of surface types.
811 if (surface_type != mojom::CompositorFrameSinkType::DEFAULT)
812 return;
813 ServerWindow* window = GetWindow(window_id); 810 ServerWindow* window = GetWindow(window_id);
814 // If the window doesn't have a parent then we have nothing to propagate. 811 // If the window doesn't have a parent then we have nothing to propagate.
815 if (!window || !window->parent()) 812 if (!window)
816 return; 813 return;
814
815 // Cache the last submitted surface ID in the window server.
816 // DisplayCompositorFrameSink may submit a CompositorFrame without
817 // creating a CompositorFrameSinkManager.
818 window->GetOrCreateCompositorFrameSinkManager()->SetLatestSurfaceInfo(
819 compositor_frame_sink_type, surface_id, frame_size);
820
821 // We only care about propagating default surface IDs.
822 // TODO(fsamuel, sadrul): we should get rid of CompositorFrameSinkTypes.
823 if (compositor_frame_sink_type != mojom::CompositorFrameSinkType::DEFAULT ||
824 !window->parent()) {
825 return;
826 }
817 WindowTree* window_tree = GetTreeWithId(window->parent()->id().client_id); 827 WindowTree* window_tree = GetTreeWithId(window->parent()->id().client_id);
818 if (window_tree) { 828 if (window_tree) {
819 window_tree->ProcessWindowSurfaceChanged(window, surface_id, frame_size, 829 window_tree->ProcessWindowSurfaceChanged(window, surface_id, frame_size,
820 device_scale_factor); 830 device_scale_factor);
821 } 831 }
822 } 832 }
823 833
824 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id, 834 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id,
825 const UserId& active_id) { 835 const UserId& active_id) {
826 if (IsUserInHighContrastMode(previously_active_id) == 836 if (IsUserInHighContrastMode(previously_active_id) ==
827 IsUserInHighContrastMode(active_id)) 837 IsUserInHighContrastMode(active_id))
828 return; 838 return;
829 for (Display* display : display_manager_->displays()) { 839 for (Display* display : display_manager_->displays()) {
830 display->SchedulePaint(display->root_window(), 840 display->SchedulePaint(display->root_window(),
831 gfx::Rect(display->root_window()->bounds().size())); 841 gfx::Rect(display->root_window()->bounds().size()));
832 } 842 }
833 } 843 }
834 844
835 void WindowServer::OnUserIdAdded(const UserId& id) { 845 void WindowServer::OnUserIdAdded(const UserId& id) {
836 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); 846 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr);
837 } 847 }
838 848
839 void WindowServer::OnUserIdRemoved(const UserId& id) { 849 void WindowServer::OnUserIdRemoved(const UserId& id) {
840 activity_monitor_map_.erase(id); 850 activity_monitor_map_.erase(id);
841 } 851 }
842 852
843 } // namespace ws 853 } // namespace ws
844 } // namespace ui 854 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/server_window_compositor_frame_sink_manager_test_api.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