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

Unified Diff: ash/display/display_manager.cc

Issue 1130653004: Remove the removed display from the active list after displays are added (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/display/display_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_manager.cc
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index f67c62faaccf72375d68f131e45da62748c47794..c04264b0a9f2d76ae60ed00956cf328e679955d8 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -794,21 +794,19 @@ void DisplayManager::UpdateDisplays(
RefreshFontParams();
base::AutoReset<bool> resetter(&change_display_upon_host_resize_, false);
+ int active_display_list_size = active_display_list_.size();
// Temporarily add displays to be removed because display object
// being removed are accessed during shutting down the root.
active_display_list_.insert(active_display_list_.end(),
removed_displays.begin(), removed_displays.end());
- for (DisplayList::const_reverse_iterator iter = removed_displays.rbegin();
- iter != removed_displays.rend(); ++iter) {
- screen_->NotifyDisplayRemoved(active_display_list_.back());
- active_display_list_.pop_back();
- }
+ for (const auto& display : removed_displays)
+ screen_->NotifyDisplayRemoved(display);
- for (std::vector<size_t>::iterator iter = added_display_indices.begin();
- iter != added_display_indices.end(); ++iter) {
- screen_->NotifyDisplayAdded(active_display_list_[*iter]);
- }
+ for (size_t index : added_display_indices)
+ screen_->NotifyDisplayAdded(active_display_list_[index]);
+
+ active_display_list_.resize(active_display_list_size);
bool notify_primary_change =
delegate_ ? old_primary.id() != screen_->GetPrimaryDisplay().id() : false;
« no previous file with comments | « no previous file | ash/display/display_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698