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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | ash/display/display_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/display/display_manager.h" 5 #include "ash/display/display_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 display_changes[updated_index] = metrics; 787 display_changes[updated_index] = metrics;
788 } 788 }
789 } 789 }
790 } 790 }
791 791
792 active_display_list_ = new_displays; 792 active_display_list_ = new_displays;
793 793
794 RefreshFontParams(); 794 RefreshFontParams();
795 base::AutoReset<bool> resetter(&change_display_upon_host_resize_, false); 795 base::AutoReset<bool> resetter(&change_display_upon_host_resize_, false);
796 796
797 int active_display_list_size = active_display_list_.size();
797 // Temporarily add displays to be removed because display object 798 // Temporarily add displays to be removed because display object
798 // being removed are accessed during shutting down the root. 799 // being removed are accessed during shutting down the root.
799 active_display_list_.insert(active_display_list_.end(), 800 active_display_list_.insert(active_display_list_.end(),
800 removed_displays.begin(), removed_displays.end()); 801 removed_displays.begin(), removed_displays.end());
801 802
802 for (DisplayList::const_reverse_iterator iter = removed_displays.rbegin(); 803 for (const auto& display : removed_displays)
803 iter != removed_displays.rend(); ++iter) { 804 screen_->NotifyDisplayRemoved(display);
804 screen_->NotifyDisplayRemoved(active_display_list_.back());
805 active_display_list_.pop_back();
806 }
807 805
808 for (std::vector<size_t>::iterator iter = added_display_indices.begin(); 806 for (size_t index : added_display_indices)
809 iter != added_display_indices.end(); ++iter) { 807 screen_->NotifyDisplayAdded(active_display_list_[index]);
810 screen_->NotifyDisplayAdded(active_display_list_[*iter]); 808
811 } 809 active_display_list_.resize(active_display_list_size);
812 810
813 bool notify_primary_change = 811 bool notify_primary_change =
814 delegate_ ? old_primary.id() != screen_->GetPrimaryDisplay().id() : false; 812 delegate_ ? old_primary.id() != screen_->GetPrimaryDisplay().id() : false;
815 813
816 for (std::map<size_t, uint32_t>::iterator iter = display_changes.begin(); 814 for (std::map<size_t, uint32_t>::iterator iter = display_changes.begin();
817 iter != display_changes.end(); 815 iter != display_changes.end();
818 ++iter) { 816 ++iter) {
819 uint32_t metrics = iter->second; 817 uint32_t metrics = iter->second;
820 const gfx::Display& updated_display = active_display_list_[iter->first]; 818 const gfx::Display& updated_display = active_display_list_[iter->first];
821 819
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 gfx::Rect(new_secondary_origin, secondary_bounds.size())); 1312 gfx::Rect(new_secondary_origin, secondary_bounds.size()));
1315 secondary_display->UpdateWorkAreaFromInsets(insets); 1313 secondary_display->UpdateWorkAreaFromInsets(insets);
1316 } 1314 }
1317 1315
1318 void DisplayManager::RunPendingTasksForTest() { 1316 void DisplayManager::RunPendingTasksForTest() {
1319 if (!software_mirroring_display_list_.empty()) 1317 if (!software_mirroring_display_list_.empty())
1320 base::RunLoop().RunUntilIdle(); 1318 base::RunLoop().RunUntilIdle();
1321 } 1319 }
1322 1320
1323 } // namespace ash 1321 } // namespace ash
OLDNEW
« 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