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

Unified Diff: ui/display/manager/display_layout.cc

Issue 2518233002: Enable setting primary display for 3+ displays (Closed)
Patch Set: Rebase and expand tests Created 4 years, 1 month 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 | « ash/display/window_tree_host_manager_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/manager/display_layout.cc
diff --git a/ui/display/manager/display_layout.cc b/ui/display/manager/display_layout.cc
index 25660de1af10c97f7f99a28c95d5557570c6a1ab..d3a08fe6297de8bf37f1be2a1beed10bc1d4cd80 100644
--- a/ui/display/manager/display_layout.cc
+++ b/ui/display/manager/display_layout.cc
@@ -214,15 +214,19 @@ bool DisplayLayout::Validate(const DisplayIdList& list,
if (layout.placement_list.size() == 0u)
return true;
- bool has_primary_as_parent = false;
- int64_t id = 0;
oshima 2016/11/22 21:47:18 this should have been std::numeric_limits<int64_t>
+ // Placements are sorted by display_id.
+ if (!std::is_sorted(layout.placement_list.begin(),
+ layout.placement_list.end(),
+ [](const display::DisplayPlacement& d1,
+ const display::DisplayPlacement& d2) {
+ return d1.display_id < d2.display_id;
+ })) {
+ LOG(ERROR) << "PlacementList must be sorted by display_id";
+ return false;
+ }
oshima 2016/11/22 21:47:18 do you need this?
afakhry 2016/11/22 22:16:21 Reverted to the old way and fixed its bug.
+ bool has_primary_as_parent = false;
for (const auto& placement : layout.placement_list) {
- // Placements are sorted by display_id.
- if (id >= placement.display_id) {
- LOG(ERROR) << "PlacementList must be sorted by display_id";
- return false;
- }
if (placement.display_id == kInvalidDisplayId) {
LOG(ERROR) << "display_id is not initialized";
return false;
« no previous file with comments | « ash/display/window_tree_host_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698