OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/display_manager.h" | 5 #include "services/ui/ws/display_manager.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 void DisplayManager::DestroyDisplay(Display* display) { | 57 void DisplayManager::DestroyDisplay(Display* display) { |
58 if (pending_displays_.count(display)) { | 58 if (pending_displays_.count(display)) { |
59 pending_displays_.erase(display); | 59 pending_displays_.erase(display); |
60 } else { | 60 } else { |
61 for (const auto& pair : user_display_managers_) | 61 for (const auto& pair : user_display_managers_) |
62 pair.second->OnWillDestroyDisplay(display); | 62 pair.second->OnWillDestroyDisplay(display); |
63 | 63 |
64 DCHECK(displays_.count(display)); | 64 DCHECK(displays_.count(display)); |
65 displays_.erase(display); | 65 displays_.erase(display); |
| 66 window_server_->OnDisplayDestroyed(display); |
66 } | 67 } |
67 delete display; | 68 delete display; |
68 | 69 |
69 // If we have no more roots left, let the app know so it can terminate. | 70 // If we have no more roots left, let the app know so it can terminate. |
70 // TODO(sky): move to delegate/observer. | 71 // TODO(sky): move to delegate/observer. |
71 if (displays_.empty() && pending_displays_.empty()) | 72 if (displays_.empty() && pending_displays_.empty()) |
72 window_server_->OnNoMoreDisplays(); | 73 window_server_->OnNoMoreDisplays(); |
73 } | 74 } |
74 | 75 |
75 void DisplayManager::DestroyAllDisplays() { | 76 void DisplayManager::DestroyAllDisplays() { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 void DisplayManager::OnPrimaryDisplayChanged(int64_t primary_display_id) { | 219 void DisplayManager::OnPrimaryDisplayChanged(int64_t primary_display_id) { |
219 // TODO(kylechar): Send IPCs to WM clients first. | 220 // TODO(kylechar): Send IPCs to WM clients first. |
220 | 221 |
221 // Send IPCs to any DisplayManagerObservers. | 222 // Send IPCs to any DisplayManagerObservers. |
222 for (const auto& pair : user_display_managers_) | 223 for (const auto& pair : user_display_managers_) |
223 pair.second->OnPrimaryDisplayChanged(primary_display_id); | 224 pair.second->OnPrimaryDisplayChanged(primary_display_id); |
224 } | 225 } |
225 | 226 |
226 } // namespace ws | 227 } // namespace ws |
227 } // namespace ui | 228 } // namespace ui |
OLD | NEW |