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

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

Issue 2481263002: Introduce Display Compositor mojo interface. Use InProcessContextProvider. (Closed)
Patch Set: Improved comment Created 4 years 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // GpuServiceProxy. 49 // GpuServiceProxy.
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_proxy_(new GpuServiceProxy(this)), 57 gpu_proxy_(new GpuServiceProxy(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 display_compositor_client_binding_(this) {
60 display_compositor_(new DisplayCompositor(
61 display_compositor_client_binding_.CreateInterfacePtrAndBind())) {
62 user_id_tracker_.AddObserver(this); 60 user_id_tracker_.AddObserver(this);
63 OnUserIdAdded(user_id_tracker_.active_id()); 61 OnUserIdAdded(user_id_tracker_.active_id());
62 display_compositor_request_ = mojo::GetProxy(&display_compositor_);
64 } 63 }
65 64
66 WindowServer::~WindowServer() { 65 WindowServer::~WindowServer() {
67 in_destructor_ = true; 66 in_destructor_ = true;
68 67
69 for (auto& pair : tree_map_) 68 for (auto& pair : tree_map_)
70 pair.second->PrepareForWindowServerShutdown(); 69 pair.second->PrepareForWindowServerShutdown();
71 70
72 // 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
73 // 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 return current_drag_loop_->window; 487 return current_drag_loop_->window;
489 return nullptr; 488 return nullptr;
490 } 489 }
491 490
492 WindowTree* WindowServer::GetCurrentDragLoopInitiator() { 491 WindowTree* WindowServer::GetCurrentDragLoopInitiator() {
493 if (current_drag_loop_) 492 if (current_drag_loop_)
494 return current_drag_loop_->initiator; 493 return current_drag_loop_->initiator;
495 return nullptr; 494 return nullptr;
496 } 495 }
497 496
498 void WindowServer::OnDisplayReady(Display* display, bool is_first) { 497 void WindowServer::OnDisplayReady(Display* display, bool is_first) {
rjkroege 2016/11/21 23:05:36 Please explain the thread startup ordering. Partic
Fady Samuel 2016/11/22 01:02:23 Done.
499 if (gpu_channel_)
500 display->platform_display()->OnGpuChannelEstablished(gpu_channel_);
501 if (is_first) 498 if (is_first)
502 delegate_->OnFirstDisplayReady(); 499 delegate_->OnFirstDisplayReady();
503 } 500 }
504 501
505 void WindowServer::OnNoMoreDisplays() { 502 void WindowServer::OnNoMoreDisplays() {
506 delegate_->OnNoMoreDisplays(); 503 delegate_->OnNoMoreDisplays();
507 } 504 }
508 505
509 WindowManagerState* WindowServer::GetWindowManagerStateForUser( 506 WindowManagerState* WindowServer::GetWindowManagerStateForUser(
510 const UserId& user_id) { 507 const UserId& user_id) {
511 return window_manager_window_tree_factory_set_.GetWindowManagerStateForUser( 508 return window_manager_window_tree_factory_set_.GetWindowManagerStateForUser(
512 user_id); 509 user_id);
513 } 510 }
514 511
515 ui::DisplayCompositor* WindowServer::GetDisplayCompositor() { 512 cc::mojom::DisplayCompositor* WindowServer::GetDisplayCompositor() {
516 return display_compositor_.get(); 513 return display_compositor_.get();
517 } 514 }
518 515
519 bool WindowServer::GetFrameDecorationsForUser( 516 bool WindowServer::GetFrameDecorationsForUser(
520 const UserId& user_id, 517 const UserId& user_id,
521 mojom::FrameDecorationValuesPtr* values) { 518 mojom::FrameDecorationValuesPtr* values) {
522 WindowManagerState* window_manager_state = 519 WindowManagerState* window_manager_state =
523 window_manager_window_tree_factory_set_.GetWindowManagerStateForUser( 520 window_manager_window_tree_factory_set_.GetWindowManagerStateForUser(
524 user_id); 521 user_id);
525 if (!window_manager_state) 522 if (!window_manager_state)
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 ServerWindow* transient_child) { 735 ServerWindow* transient_child) {
739 // If we're deleting a window, then this is a superfluous message. 736 // If we're deleting a window, then this is a superfluous message.
740 if (current_operation_type() == OperationType::DELETE_WINDOW) 737 if (current_operation_type() == OperationType::DELETE_WINDOW)
741 return; 738 return;
742 for (auto& pair : tree_map_) { 739 for (auto& pair : tree_map_) {
743 pair.second->ProcessTransientWindowRemoved(window, transient_child, 740 pair.second->ProcessTransientWindowRemoved(window, transient_child,
744 IsOperationSource(pair.first)); 741 IsOperationSource(pair.first));
745 } 742 }
746 } 743 }
747 744
748 void WindowServer::OnGpuChannelEstablished( 745 void WindowServer::OnGpuServiceInitialized() {
rjkroege 2016/11/21 23:05:36 the declaration of this method requires more docum
Fady Samuel 2016/11/22 01:02:23 Done.
749 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { 746 gpu_proxy_->CreateDisplayCompositor(
750 gpu_channel_ = std::move(gpu_channel); 747 std::move(display_compositor_request_),
751 const std::set<Display*>& displays = display_manager()->displays(); 748 display_compositor_client_binding_.CreateInterfacePtrAndBind());
752 for (auto* display : displays)
753 display->platform_display()->OnGpuChannelEstablished(gpu_channel_);
754 // TODO(kylechar): When gpu channel is removed, this can instead happen 749 // TODO(kylechar): When gpu channel is removed, this can instead happen
755 // earlier, after GpuServiceProxy::OnInitialized(). 750 // earlier, after GpuServiceProxy::OnInitialized().
756 delegate_->StartDisplayInit(); 751 delegate_->StartDisplayInit();
757 } 752 }
758 753
759 void WindowServer::OnSurfaceCreated(const cc::SurfaceId& surface_id, 754 void WindowServer::OnSurfaceCreated(const cc::SurfaceId& surface_id,
760 const gfx::Size& frame_size, 755 const gfx::Size& frame_size,
761 float device_scale_factor) { 756 float device_scale_factor) {
762 WindowId window_id( 757 WindowId window_id(
763 WindowIdFromTransportId(surface_id.frame_sink_id().client_id())); 758 WindowIdFromTransportId(surface_id.frame_sink_id().client_id()));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 void WindowServer::OnUserIdAdded(const UserId& id) { 802 void WindowServer::OnUserIdAdded(const UserId& id) {
808 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); 803 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr);
809 } 804 }
810 805
811 void WindowServer::OnUserIdRemoved(const UserId& id) { 806 void WindowServer::OnUserIdRemoved(const UserId& id) {
812 activity_monitor_map_.erase(id); 807 activity_monitor_map_.erase(id);
813 } 808 }
814 809
815 } // namespace ws 810 } // namespace ws
816 } // namespace ui 811 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698