Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 28 matching lines...) Expand all Loading... | |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 struct WindowServer::CurrentDragLoopState { | 41 struct WindowServer::CurrentDragLoopState { |
| 42 uint32_t change_id; | 42 uint32_t change_id; |
| 43 ServerWindow* window; | 43 ServerWindow* window; |
| 44 WindowTree* initiator; | 44 WindowTree* initiator; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 WindowServer::WindowServer(WindowServerDelegate* delegate) | 47 WindowServer::WindowServer(WindowServerDelegate* delegate) |
| 48 : delegate_(delegate), | 48 : delegate_(delegate), |
| 49 display_compositor_(new DisplayCompositor()), | 49 display_compositor_(new DisplayCompositor(this)), |
| 50 next_client_id_(1), | 50 next_client_id_(1), |
| 51 display_manager_(new DisplayManager(this, &user_id_tracker_)), | 51 display_manager_(new DisplayManager(this, &user_id_tracker_)), |
| 52 current_operation_(nullptr), | 52 current_operation_(nullptr), |
| 53 in_destructor_(false), | 53 in_destructor_(false), |
| 54 next_wm_change_id_(0), | 54 next_wm_change_id_(0), |
| 55 gpu_proxy_(new GpuServiceProxy(this)), | 55 gpu_proxy_(new GpuServiceProxy(this)), |
| 56 window_manager_window_tree_factory_set_(this, &user_id_tracker_) { | 56 window_manager_window_tree_factory_set_(this, &user_id_tracker_) { |
| 57 user_id_tracker_.AddObserver(this); | 57 user_id_tracker_.AddObserver(this); |
| 58 OnUserIdAdded(user_id_tracker_.active_id()); | 58 OnUserIdAdded(user_id_tracker_.active_id()); |
| 59 } | 59 } |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 792 } | 792 } |
| 793 | 793 |
| 794 void WindowServer::OnGpuChannelEstablished( | 794 void WindowServer::OnGpuChannelEstablished( |
| 795 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { | 795 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { |
| 796 gpu_channel_ = std::move(gpu_channel); | 796 gpu_channel_ = std::move(gpu_channel); |
| 797 const std::set<Display*>& displays = display_manager()->displays(); | 797 const std::set<Display*>& displays = display_manager()->displays(); |
| 798 for (auto* display : displays) | 798 for (auto* display : displays) |
| 799 display->platform_display()->OnGpuChannelEstablished(gpu_channel_); | 799 display->platform_display()->OnGpuChannelEstablished(gpu_channel_); |
| 800 } | 800 } |
| 801 | 801 |
| 802 void WindowServer::OnSurfaceCreated(const cc::SurfaceId& surface_id, | |
| 803 const gfx::Size& frame_size, | |
| 804 float device_scale_factor) { | |
| 805 WindowId window_id( | |
| 806 WindowIdFromTransportId(surface_id.frame_sink_id().client_id())); | |
| 807 mojom::SurfaceType surface_type( | |
| 808 static_cast<mojom::SurfaceType>(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::SurfaceType::DEFAULT) | |
| 812 return; | |
| 813 ServerWindow* window = GetWindow(window_id); | |
| 814 // If the window doesn't have a parent then we have nothing to propagate. | |
| 815 if (!window || !window->parent()) | |
| 816 return; | |
| 817 for (auto& pair : tree_map_) { | |
| 818 pair.second->ProcessWindowSurfaceCreated(window, surface_id, frame_size, | |
|
sky
2016/10/14 20:55:46
Only the owner of window->parent() cares about thi
Fady Samuel
2016/10/14 21:32:48
Done.
| |
| 819 device_scale_factor); | |
| 820 } | |
| 821 } | |
| 822 | |
| 802 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id, | 823 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id, |
| 803 const UserId& active_id) { | 824 const UserId& active_id) { |
| 804 if (IsUserInHighContrastMode(previously_active_id) == | 825 if (IsUserInHighContrastMode(previously_active_id) == |
| 805 IsUserInHighContrastMode(active_id)) | 826 IsUserInHighContrastMode(active_id)) |
| 806 return; | 827 return; |
| 807 for (Display* display : display_manager_->displays()) { | 828 for (Display* display : display_manager_->displays()) { |
| 808 display->SchedulePaint(display->root_window(), | 829 display->SchedulePaint(display->root_window(), |
| 809 gfx::Rect(display->root_window()->bounds().size())); | 830 gfx::Rect(display->root_window()->bounds().size())); |
| 810 } | 831 } |
| 811 } | 832 } |
| 812 | 833 |
| 813 void WindowServer::OnUserIdAdded(const UserId& id) { | 834 void WindowServer::OnUserIdAdded(const UserId& id) { |
| 814 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 835 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
| 815 } | 836 } |
| 816 | 837 |
| 817 void WindowServer::OnUserIdRemoved(const UserId& id) { | 838 void WindowServer::OnUserIdRemoved(const UserId& id) { |
| 818 activity_monitor_map_.erase(id); | 839 activity_monitor_map_.erase(id); |
| 819 } | 840 } |
| 820 | 841 |
| 821 } // namespace ws | 842 } // namespace ws |
| 822 } // namespace ui | 843 } // namespace ui |
| OLD | NEW |