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

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

Issue 2797453002: Rename DisplayCompositor to MojoFrameSinkManager. (Closed)
Patch Set: Rebase. 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
49 // GpuHost.
50 WindowServer::WindowServer(WindowServerDelegate* delegate) 48 WindowServer::WindowServer(WindowServerDelegate* delegate)
51 : delegate_(delegate), 49 : delegate_(delegate),
52 next_client_id_(1), 50 next_client_id_(1),
53 display_manager_(new DisplayManager(this, &user_id_tracker_)), 51 display_manager_(new DisplayManager(this, &user_id_tracker_)),
54 current_operation_(nullptr), 52 current_operation_(nullptr),
55 in_destructor_(false), 53 in_destructor_(false),
56 next_wm_change_id_(0), 54 next_wm_change_id_(0),
57 gpu_host_(new GpuHost(this)), 55 gpu_host_(new GpuHost(this)),
58 window_manager_window_tree_factory_set_(this, &user_id_tracker_), 56 window_manager_window_tree_factory_set_(this, &user_id_tracker_),
59 display_compositor_client_binding_(this) { 57 frame_sink_manager_client_binding_(this) {
60 user_id_tracker_.AddObserver(this); 58 user_id_tracker_.AddObserver(this);
61 OnUserIdAdded(user_id_tracker_.active_id()); 59 OnUserIdAdded(user_id_tracker_.active_id());
62 gpu_host_->CreateDisplayCompositor( 60 gpu_host_->CreateFrameSinkManager(
63 mojo::MakeRequest(&display_compositor_), 61 mojo::MakeRequest(&frame_sink_manager_),
64 display_compositor_client_binding_.CreateInterfacePtrAndBind()); 62 frame_sink_manager_client_binding_.CreateInterfacePtrAndBind());
65 } 63 }
66 64
67 WindowServer::~WindowServer() { 65 WindowServer::~WindowServer() {
68 in_destructor_ = true; 66 in_destructor_ = true;
69 67
70 for (auto& pair : tree_map_) 68 for (auto& pair : tree_map_)
71 pair.second->PrepareForWindowServerShutdown(); 69 pair.second->PrepareForWindowServerShutdown();
72 70
73 // Destroys the window trees results in querying for the display. Tear down 71 // 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 72 // 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() { 526 void WindowServer::OnNoMoreDisplays() {
529 delegate_->OnNoMoreDisplays(); 527 delegate_->OnNoMoreDisplays();
530 } 528 }
531 529
532 WindowManagerState* WindowServer::GetWindowManagerStateForUser( 530 WindowManagerState* WindowServer::GetWindowManagerStateForUser(
533 const UserId& user_id) { 531 const UserId& user_id) {
534 return window_manager_window_tree_factory_set_.GetWindowManagerStateForUser( 532 return window_manager_window_tree_factory_set_.GetWindowManagerStateForUser(
535 user_id); 533 user_id);
536 } 534 }
537 535
538 cc::mojom::DisplayCompositor* WindowServer::GetDisplayCompositor() { 536 cc::mojom::FrameSinkManager* WindowServer::GetFrameSinkManager() {
539 return display_compositor_.get(); 537 return frame_sink_manager_.get();
540 } 538 }
541 539
542 bool WindowServer::GetFrameDecorationsForUser( 540 bool WindowServer::GetFrameDecorationsForUser(
543 const UserId& user_id, 541 const UserId& user_id,
544 mojom::FrameDecorationValuesPtr* values) { 542 mojom::FrameDecorationValuesPtr* values) {
545 WindowManagerState* window_manager_state = 543 WindowManagerState* window_manager_state =
546 window_manager_window_tree_factory_set_.GetWindowManagerStateForUser( 544 window_manager_window_tree_factory_set_.GetWindowManagerStateForUser(
547 user_id); 545 user_id);
548 if (!window_manager_state) 546 if (!window_manager_state)
549 return false; 547 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 629 // The client that embeds |window| is expected to submit a CompositorFrame
632 // that references |surface_id|. Have the parent claim ownership of the 630 // that references |surface_id|. Have the parent claim ownership of the
633 // temporary reference to |surface_id|. If the parent client crashes before it 631 // 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 632 // 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 633 // no parent client embeds |window| then tell the GPU to drop the temporary
636 // reference immediately. 634 // reference immediately.
637 if (current) { 635 if (current) {
638 current->GetOrCreateCompositorFrameSinkManager()->ClaimTemporaryReference( 636 current->GetOrCreateCompositorFrameSinkManager()->ClaimTemporaryReference(
639 surface_id); 637 surface_id);
640 } else { 638 } else {
641 display_compositor_->DropTemporaryReference(surface_id); 639 frame_sink_manager_->DropTemporaryReference(surface_id);
642 } 640 }
643 } 641 }
644 642
645 ServerWindow* WindowServer::GetRootWindow(const ServerWindow* window) { 643 ServerWindow* WindowServer::GetRootWindow(const ServerWindow* window) {
646 Display* display = display_manager_->GetDisplayContaining(window); 644 Display* display = display_manager_->GetDisplayContaining(window);
647 return display ? display->root_window() : nullptr; 645 return display ? display->root_window() : nullptr;
648 } 646 }
649 647
650 void WindowServer::OnWindowDestroyed(ServerWindow* window) { 648 void WindowServer::OnWindowDestroyed(ServerWindow* window) {
651 ProcessWindowDeleted(window); 649 ProcessWindowDeleted(window);
(...skipping 16 matching lines...) Expand all
668 666
669 WindowManagerDisplayRoot* display_root = 667 WindowManagerDisplayRoot* display_root =
670 display_manager_->GetWindowManagerDisplayRoot(window); 668 display_manager_->GetWindowManagerDisplayRoot(window);
671 if (display_root) 669 if (display_root)
672 display_root->window_manager_state() 670 display_root->window_manager_state()
673 ->ReleaseCaptureBlockedByAnyModalWindow(); 671 ->ReleaseCaptureBlockedByAnyModalWindow();
674 672
675 ProcessWindowHierarchyChanged(window, new_parent, old_parent); 673 ProcessWindowHierarchyChanged(window, new_parent, old_parent);
676 674
677 if (old_parent) { 675 if (old_parent) {
678 display_compositor_->UnregisterFrameSinkHierarchy( 676 frame_sink_manager_->UnregisterFrameSinkHierarchy(
679 old_parent->frame_sink_id(), window->frame_sink_id()); 677 old_parent->frame_sink_id(), window->frame_sink_id());
680 } 678 }
681 if (new_parent) { 679 if (new_parent) {
682 display_compositor_->RegisterFrameSinkHierarchy(new_parent->frame_sink_id(), 680 frame_sink_manager_->RegisterFrameSinkHierarchy(new_parent->frame_sink_id(),
683 window->frame_sink_id()); 681 window->frame_sink_id());
684 } 682 }
685 683
686 UpdateNativeCursorFromMouseLocation(window); 684 UpdateNativeCursorFromMouseLocation(window);
687 } 685 }
688 686
689 void WindowServer::OnWindowBoundsChanged(ServerWindow* window, 687 void WindowServer::OnWindowBoundsChanged(ServerWindow* window,
690 const gfx::Rect& old_bounds, 688 const gfx::Rect& old_bounds,
691 const gfx::Rect& new_bounds) { 689 const gfx::Rect& new_bounds) {
692 if (in_destructor_) 690 if (in_destructor_)
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 delegate_->StartDisplayInit(); 809 delegate_->StartDisplayInit();
812 } 810 }
813 811
814 void WindowServer::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) { 812 void WindowServer::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) {
815 WindowId window_id( 813 WindowId window_id(
816 WindowIdFromTransportId(surface_info.id().frame_sink_id().client_id())); 814 WindowIdFromTransportId(surface_info.id().frame_sink_id().client_id()));
817 ServerWindow* window = GetWindow(window_id); 815 ServerWindow* window = GetWindow(window_id);
818 816
819 // If the window doesn't exist then we have nothing to propagate. 817 // If the window doesn't exist then we have nothing to propagate.
820 if (!window) { 818 if (!window) {
821 display_compositor_->DropTemporaryReference(surface_info.id()); 819 frame_sink_manager_->DropTemporaryReference(surface_info.id());
822 return; 820 return;
823 } 821 }
824 822
825 // This is only used for testing to observe that a window has a 823 // This is only used for testing to observe that a window has a
826 // CompositorFrame. 824 // CompositorFrame.
827 if (!window_paint_callback_.is_null()) 825 if (!window_paint_callback_.is_null())
828 window_paint_callback_.Run(window); 826 window_paint_callback_.Run(window);
829 827
830 auto* display = display_manager_->GetDisplayContaining(window); 828 auto* display = display_manager_->GetDisplayContaining(window);
831 if (display && window == display->GetActiveRootWindow()) { 829 if (display && window == display->GetActiveRootWindow()) {
(...skipping 26 matching lines...) Expand all
858 void WindowServer::OnUserIdAdded(const UserId& id) { 856 void WindowServer::OnUserIdAdded(const UserId& id) {
859 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); 857 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr);
860 } 858 }
861 859
862 void WindowServer::OnUserIdRemoved(const UserId& id) { 860 void WindowServer::OnUserIdRemoved(const UserId& id) {
863 activity_monitor_map_.erase(id); 861 activity_monitor_map_.erase(id);
864 } 862 }
865 863
866 } // namespace ws 864 } // namespace ws
867 } // namespace ui 865 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_server.h ('k') | third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698