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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 auto iter = tree_map_.find(tree->id()); | 153 auto iter = tree_map_.find(tree->id()); |
154 DCHECK(iter != tree_map_.end()); | 154 DCHECK(iter != tree_map_.end()); |
155 tree_ptr = std::move(iter->second); | 155 tree_ptr = std::move(iter->second); |
156 tree_map_.erase(iter); | 156 tree_map_.erase(iter); |
157 } | 157 } |
158 | 158 |
159 // Notify remaining connections so that they can cleanup. | 159 // Notify remaining connections so that they can cleanup. |
160 for (auto& pair : tree_map_) | 160 for (auto& pair : tree_map_) |
161 pair.second->OnWindowDestroyingTreeImpl(tree); | 161 pair.second->OnWindowDestroyingTreeImpl(tree); |
162 | 162 |
163 // Notify the hosts, taking care to only notify each host once. | |
164 std::set<Display*> displays_notified; | |
165 for (auto* root : tree->roots()) { | |
166 // WindowTree holds its roots as a const, which is right as WindowTree | |
167 // doesn't need to modify the window. OTOH we do. We could look up the | |
168 // window using the id to get non-const version, but instead we cast. | |
169 Display* display = | |
170 display_manager_->GetDisplayContaining(const_cast<ServerWindow*>(root)); | |
171 if (display && displays_notified.count(display) == 0) { | |
172 display->OnWillDestroyTree(tree); | |
173 displays_notified.insert(display); | |
174 } | |
175 } | |
176 | |
177 window_manager_window_tree_factory_set_.DeleteFactoryAssociatedWithTree(tree); | 163 window_manager_window_tree_factory_set_.DeleteFactoryAssociatedWithTree(tree); |
178 | 164 |
179 // Remove any requests from the client that resulted in a call to the window | 165 // Remove any requests from the client that resulted in a call to the window |
180 // manager and we haven't gotten a response back yet. | 166 // manager and we haven't gotten a response back yet. |
181 std::set<uint32_t> to_remove; | 167 std::set<uint32_t> to_remove; |
182 for (auto& pair : in_flight_wm_change_map_) { | 168 for (auto& pair : in_flight_wm_change_map_) { |
183 if (pair.second.client_id == tree->id()) | 169 if (pair.second.client_id == tree->id()) |
184 to_remove.insert(pair.first); | 170 to_remove.insert(pair.first); |
185 } | 171 } |
186 for (uint32_t id : to_remove) | 172 for (uint32_t id : to_remove) |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 void WindowServer::OnUserIdAdded(const UserId& id) { | 819 void WindowServer::OnUserIdAdded(const UserId& id) { |
834 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 820 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
835 } | 821 } |
836 | 822 |
837 void WindowServer::OnUserIdRemoved(const UserId& id) { | 823 void WindowServer::OnUserIdRemoved(const UserId& id) { |
838 activity_monitor_map_.erase(id); | 824 activity_monitor_map_.erase(id); |
839 } | 825 } |
840 | 826 |
841 } // namespace ws | 827 } // namespace ws |
842 } // namespace ui | 828 } // namespace ui |
OLD | NEW |