Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/display/display_layout_store.h" | 8 #include "ash/display/display_layout_store.h" |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/display/display_util.h" | 10 #include "ash/display/display_util.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 layout->placement_list[0]->display_id == | 61 layout->placement_list[0]->display_id == |
| 62 gfx::Display::kInvalidDisplayID) { | 62 gfx::Display::kInvalidDisplayID) { |
| 63 if (layout->primary_id == list[1]) { | 63 if (layout->primary_id == list[1]) { |
| 64 layout->placement_list[0]->display_id = list[0]; | 64 layout->placement_list[0]->display_id = list[0]; |
| 65 layout->placement_list[0]->parent_display_id = list[1]; | 65 layout->placement_list[0]->parent_display_id = list[1]; |
| 66 } else { | 66 } else { |
| 67 layout->placement_list[0]->display_id = list[1]; | 67 layout->placement_list[0]->display_id = list[1]; |
| 68 layout->placement_list[0]->parent_display_id = list[0]; | 68 layout->placement_list[0]->parent_display_id = list[0]; |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 DCHECK(DisplayLayout::Validate(list, *layout.get())) << layout->ToString(); | 71 if (!DisplayLayout::Validate(list, *layout.get())) |
| 72 return; | |
| 72 layouts_[list] = std::move(layout); | 73 layouts_[list] = std::move(layout); |
| 73 } | 74 } |
| 74 | 75 |
| 75 const DisplayLayout& DisplayLayoutStore::GetRegisteredDisplayLayout( | 76 const DisplayLayout& DisplayLayoutStore::GetRegisteredDisplayLayout( |
| 76 const DisplayIdList& list) { | 77 const DisplayIdList& list) { |
| 77 DCHECK_NE(1u, list.size()); | 78 DCHECK_NE(1u, list.size()); |
| 78 const auto iter = layouts_.find(list); | 79 const auto iter = layouts_.find(list); |
| 79 const DisplayLayout* layout = iter != layouts_.end() | 80 const DisplayLayout* layout = iter != layouts_.end() |
| 80 ? iter->second.get() | 81 ? iter->second.get() |
| 81 : CreateDefaultDisplayLayout(list); | 82 : CreateDefaultDisplayLayout(list); |
| 82 DCHECK(DisplayLayout::Validate(list, *layout)) << layout->ToString(); | 83 CHECK(DisplayLayout::Validate(list, *layout)) << layout->ToString(); |
| 83 DCHECK_NE(layout->primary_id, gfx::Display::kInvalidDisplayID); | 84 CHECK_NE(layout->primary_id, gfx::Display::kInvalidDisplayID); |
|
oshima
2016/03/31 01:15:44
I'm adding CHECK to have better crash reports when
| |
| 84 return *layout; | 85 return *layout; |
| 85 } | 86 } |
| 86 | 87 |
| 87 void DisplayLayoutStore::UpdateMultiDisplayState(const DisplayIdList& list, | 88 void DisplayLayoutStore::UpdateMultiDisplayState(const DisplayIdList& list, |
| 88 bool mirrored, | 89 bool mirrored, |
| 89 bool default_unified) { | 90 bool default_unified) { |
| 90 DCHECK(layouts_.find(list) != layouts_.end()); | 91 DCHECK(layouts_.find(list) != layouts_.end()); |
| 91 if (layouts_.find(list) == layouts_.end()) | 92 if (layouts_.find(list) == layouts_.end()) |
| 92 CreateDefaultDisplayLayout(list); | 93 CreateDefaultDisplayLayout(list); |
| 93 | 94 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 107 placement->display_id = list[i + 1]; | 108 placement->display_id = list[i + 1]; |
| 108 placement->parent_display_id = list[i]; | 109 placement->parent_display_id = list[i]; |
| 109 layout->placement_list.push_back(std::move(placement)); | 110 layout->placement_list.push_back(std::move(placement)); |
| 110 } | 111 } |
| 111 layouts_[list] = std::move(layout); | 112 layouts_[list] = std::move(layout); |
| 112 auto iter = layouts_.find(list); | 113 auto iter = layouts_.find(list); |
| 113 return iter->second.get(); | 114 return iter->second.get(); |
| 114 } | 115 } |
| 115 | 116 |
| 116 } // namespace ash | 117 } // namespace ash |
| OLD | NEW |