| OLD | NEW |
| 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 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 | 1319 |
| 1320 void DisplayManager::ApplyDisplayLayout(const DisplayLayout& layout, | 1320 void DisplayManager::ApplyDisplayLayout(const DisplayLayout& layout, |
| 1321 DisplayList* display_list, | 1321 DisplayList* display_list, |
| 1322 std::vector<int64_t>* updated_ids) { | 1322 std::vector<int64_t>* updated_ids) { |
| 1323 // Layout from primary, then dependent displays. | 1323 // Layout from primary, then dependent displays. |
| 1324 std::set<int64_t> parents; | 1324 std::set<int64_t> parents; |
| 1325 parents.insert(layout.primary_id); | 1325 parents.insert(layout.primary_id); |
| 1326 while (parents.size()) { | 1326 while (parents.size()) { |
| 1327 int64_t parent_id = *parents.begin(); | 1327 int64_t parent_id = *parents.begin(); |
| 1328 parents.erase(parent_id); | 1328 parents.erase(parent_id); |
| 1329 for (const DisplayPlacement* placement : layout.placement_list) { | 1329 for (const DisplayPlacement& placement : layout.placement_list) { |
| 1330 if (placement->parent_display_id == parent_id) { | 1330 if (placement.parent_display_id == parent_id) { |
| 1331 if (ApplyDisplayPlacement(*placement, display_list) && updated_ids) | 1331 if (ApplyDisplayPlacement(placement, display_list) && updated_ids) |
| 1332 updated_ids->push_back(placement->display_id); | 1332 updated_ids->push_back(placement.display_id); |
| 1333 parents.insert(placement->display_id); | 1333 parents.insert(placement.display_id); |
| 1334 } | 1334 } |
| 1335 } | 1335 } |
| 1336 } | 1336 } |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 bool DisplayManager::ApplyDisplayPlacement(const DisplayPlacement& placement, | 1339 bool DisplayManager::ApplyDisplayPlacement(const DisplayPlacement& placement, |
| 1340 DisplayList* display_list) { | 1340 DisplayList* display_list) { |
| 1341 const gfx::Display& parent_display = | 1341 const gfx::Display& parent_display = |
| 1342 *FindDisplayById(display_list, placement.parent_display_id); | 1342 *FindDisplayById(display_list, placement.parent_display_id); |
| 1343 DCHECK(parent_display.is_valid()); | 1343 DCHECK(parent_display.is_valid()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 | 1395 |
| 1396 return old_bounds != target_display->bounds(); | 1396 return old_bounds != target_display->bounds(); |
| 1397 } | 1397 } |
| 1398 | 1398 |
| 1399 void DisplayManager::RunPendingTasksForTest() { | 1399 void DisplayManager::RunPendingTasksForTest() { |
| 1400 if (!software_mirroring_display_list_.empty()) | 1400 if (!software_mirroring_display_list_.empty()) |
| 1401 base::RunLoop().RunUntilIdle(); | 1401 base::RunLoop().RunUntilIdle(); |
| 1402 } | 1402 } |
| 1403 | 1403 |
| 1404 } // namespace ash | 1404 } // namespace ash |
| OLD | NEW |