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

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

Issue 2797453002: Rename DisplayCompositor to MojoFrameSinkManager. (Closed)
Patch Set: Fix comments. Created 3 years, 8 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 27 matching lines...) Expand all
38 WindowTree* initiator; 38 WindowTree* initiator;
39 gfx::Rect revert_bounds; 39 gfx::Rect revert_bounds;
40 }; 40 };
41 41
42 struct WindowServer::CurrentDragLoopState { 42 struct WindowServer::CurrentDragLoopState {
43 uint32_t change_id; 43 uint32_t change_id;
44 ServerWindow* window; 44 ServerWindow* window;
45 WindowTree* initiator; 45 WindowTree* initiator;
46 }; 46 };
47 47
48 // TODO(fsamuel): DisplayCompositor should be a mojo interface dispensed by 48 // TODO(fsamuel): FrameSinkManager should be a mojo interface dispensed by
msw 2017/04/03 19:22:13 q: Is this not the case?
kylechar 2017/04/03 19:54:16 Done.
49 // GpuHost. 49 // GpuHost.
50 WindowServer::WindowServer(WindowServerDelegate* delegate) 50 WindowServer::WindowServer(WindowServerDelegate* delegate)
51 : delegate_(delegate), 51 : delegate_(delegate),
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_host_(new GpuHost(this)), 57 gpu_host_(new GpuHost(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 frame_sink_manager_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 gpu_host_->CreateDisplayCompositor( 62 gpu_host_->CreateFrameSinkManager(
63 mojo::MakeRequest(&display_compositor_), 63 mojo::MakeRequest(&frame_sink_manager_),
64 display_compositor_client_binding_.CreateInterfacePtrAndBind()); 64 frame_sink_manager_client_binding_.CreateInterfacePtrAndBind());
65 } 65 }
66 66
67 WindowServer::~WindowServer() { 67 WindowServer::~WindowServer() {
68 in_destructor_ = true; 68 in_destructor_ = true;
69 69
70 for (auto& pair : tree_map_) 70 for (auto& pair : tree_map_)
71 pair.second->PrepareForWindowServerShutdown(); 71 pair.second->PrepareForWindowServerShutdown();
72 72
73 // Destroys the window trees results in querying for the display. Tear down 73 // Destroys the window trees results in querying for the display. Tear down
74 // the displays first so that the trees are notified of the display going 74 // the displays first so that the trees are notified of the display going
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 void WindowServer::OnNoMoreDisplays() { 528 void WindowServer::OnNoMoreDisplays() {
529 delegate_->OnNoMoreDisplays(); 529 delegate_->OnNoMoreDisplays();
530 } 530 }
531 531
532 WindowManagerState* WindowServer::GetWindowManagerStateForUser( 532 WindowManagerState* WindowServer::GetWindowManagerStateForUser(
533 const UserId& user_id) { 533 const UserId& user_id) {
534 return window_manager_window_tree_factory_set_.GetWindowManagerStateForUser( 534 return window_manager_window_tree_factory_set_.GetWindowManagerStateForUser(
535 user_id); 535 user_id);
536 } 536 }
537 537
538 cc::mojom::DisplayCompositor* WindowServer::GetDisplayCompositor() { 538 cc::mojom::FrameSinkManager* WindowServer::GetFrameSinkManager() {
539 return display_compositor_.get(); 539 return frame_sink_manager_.get();
540 } 540 }
541 541
542 bool WindowServer::GetFrameDecorationsForUser( 542 bool WindowServer::GetFrameDecorationsForUser(
543 const UserId& user_id, 543 const UserId& user_id,
544 mojom::FrameDecorationValuesPtr* values) { 544 mojom::FrameDecorationValuesPtr* values) {
545 WindowManagerState* window_manager_state = 545 WindowManagerState* window_manager_state =
546 window_manager_window_tree_factory_set_.GetWindowManagerStateForUser( 546 window_manager_window_tree_factory_set_.GetWindowManagerStateForUser(
547 user_id); 547 user_id);
548 if (!window_manager_state) 548 if (!window_manager_state)
549 return false; 549 return false;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 // The client that embeds |window| is expected to submit a CompositorFrame 631 // The client that embeds |window| is expected to submit a CompositorFrame
632 // that references |surface_id|. Have the parent claim ownership of the 632 // that references |surface_id|. Have the parent claim ownership of the
633 // temporary reference to |surface_id|. If the parent client crashes before it 633 // temporary reference to |surface_id|. If the parent client crashes before it
634 // adds a surface reference then the GPU can cleanup temporary references. If 634 // adds a surface reference then the GPU can cleanup temporary references. If
635 // no parent client embeds |window| then tell the GPU to drop the temporary 635 // no parent client embeds |window| then tell the GPU to drop the temporary
636 // reference immediately. 636 // reference immediately.
637 if (current) { 637 if (current) {
638 current->GetOrCreateCompositorFrameSinkManager()->ClaimTemporaryReference( 638 current->GetOrCreateCompositorFrameSinkManager()->ClaimTemporaryReference(
639 surface_id); 639 surface_id);
640 } else { 640 } else {
641 display_compositor_->DropTemporaryReference(surface_id); 641 frame_sink_manager_->DropTemporaryReference(surface_id);
642 } 642 }
643 } 643 }
644 644
645 ServerWindow* WindowServer::GetRootWindow(const ServerWindow* window) { 645 ServerWindow* WindowServer::GetRootWindow(const ServerWindow* window) {
646 Display* display = display_manager_->GetDisplayContaining(window); 646 Display* display = display_manager_->GetDisplayContaining(window);
647 return display ? display->root_window() : nullptr; 647 return display ? display->root_window() : nullptr;
648 } 648 }
649 649
650 void WindowServer::OnWindowDestroyed(ServerWindow* window) { 650 void WindowServer::OnWindowDestroyed(ServerWindow* window) {
651 ProcessWindowDeleted(window); 651 ProcessWindowDeleted(window);
(...skipping 16 matching lines...) Expand all
668 668
669 WindowManagerDisplayRoot* display_root = 669 WindowManagerDisplayRoot* display_root =
670 display_manager_->GetWindowManagerDisplayRoot(window); 670 display_manager_->GetWindowManagerDisplayRoot(window);
671 if (display_root) 671 if (display_root)
672 display_root->window_manager_state() 672 display_root->window_manager_state()
673 ->ReleaseCaptureBlockedByAnyModalWindow(); 673 ->ReleaseCaptureBlockedByAnyModalWindow();
674 674
675 ProcessWindowHierarchyChanged(window, new_parent, old_parent); 675 ProcessWindowHierarchyChanged(window, new_parent, old_parent);
676 676
677 if (old_parent) { 677 if (old_parent) {
678 display_compositor_->UnregisterFrameSinkHierarchy( 678 frame_sink_manager_->UnregisterFrameSinkHierarchy(
679 old_parent->frame_sink_id(), window->frame_sink_id()); 679 old_parent->frame_sink_id(), window->frame_sink_id());
680 } 680 }
681 if (new_parent) { 681 if (new_parent) {
682 display_compositor_->RegisterFrameSinkHierarchy(new_parent->frame_sink_id(), 682 frame_sink_manager_->RegisterFrameSinkHierarchy(new_parent->frame_sink_id(),
683 window->frame_sink_id()); 683 window->frame_sink_id());
684 } 684 }
685 685
686 UpdateNativeCursorFromMouseLocation(window); 686 UpdateNativeCursorFromMouseLocation(window);
687 } 687 }
688 688
689 void WindowServer::OnWindowBoundsChanged(ServerWindow* window, 689 void WindowServer::OnWindowBoundsChanged(ServerWindow* window,
690 const gfx::Rect& old_bounds, 690 const gfx::Rect& old_bounds,
691 const gfx::Rect& new_bounds) { 691 const gfx::Rect& new_bounds) {
692 if (in_destructor_) 692 if (in_destructor_)
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 delegate_->StartDisplayInit(); 811 delegate_->StartDisplayInit();
812 } 812 }
813 813
814 void WindowServer::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) { 814 void WindowServer::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) {
815 WindowId window_id( 815 WindowId window_id(
816 WindowIdFromTransportId(surface_info.id().frame_sink_id().client_id())); 816 WindowIdFromTransportId(surface_info.id().frame_sink_id().client_id()));
817 ServerWindow* window = GetWindow(window_id); 817 ServerWindow* window = GetWindow(window_id);
818 818
819 // If the window doesn't exist then we have nothing to propagate. 819 // If the window doesn't exist then we have nothing to propagate.
820 if (!window) { 820 if (!window) {
821 display_compositor_->DropTemporaryReference(surface_info.id()); 821 frame_sink_manager_->DropTemporaryReference(surface_info.id());
822 return; 822 return;
823 } 823 }
824 824
825 // This is only used for testing to observe that a window has a 825 // This is only used for testing to observe that a window has a
826 // CompositorFrame. 826 // CompositorFrame.
827 if (!window_paint_callback_.is_null()) 827 if (!window_paint_callback_.is_null())
828 window_paint_callback_.Run(window); 828 window_paint_callback_.Run(window);
829 829
830 auto* display = display_manager_->GetDisplayContaining(window); 830 auto* display = display_manager_->GetDisplayContaining(window);
831 if (display && window == display->GetActiveRootWindow()) { 831 if (display && window == display->GetActiveRootWindow()) {
(...skipping 26 matching lines...) Expand all
858 void WindowServer::OnUserIdAdded(const UserId& id) { 858 void WindowServer::OnUserIdAdded(const UserId& id) {
859 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); 859 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr);
860 } 860 }
861 861
862 void WindowServer::OnUserIdRemoved(const UserId& id) { 862 void WindowServer::OnUserIdRemoved(const UserId& id) {
863 activity_monitor_map_.erase(id); 863 activity_monitor_map_.erase(id);
864 } 864 }
865 865
866 } // namespace ws 866 } // namespace ws
867 } // namespace ui 867 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698