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

Side by Side Diff: ui/display/display_list.cc

Issue 2434923002: Handle modified displays in mustash. (Closed)
Patch Set: Fix PlatformScreenStub for tests. Created 4 years, 2 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 | « ui/display/display_list.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/display/display_list.h" 5 #include "ui/display/display_list.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/display/display_observer.h" 8 #include "ui/display/display_observer.h"
9 9
10 namespace display { 10 namespace display {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 const { 53 const {
54 return primary_display_index_ == -1 54 return primary_display_index_ == -1
55 ? displays_.end() 55 ? displays_.end()
56 : displays_.begin() + primary_display_index_; 56 : displays_.begin() + primary_display_index_;
57 } 57 }
58 58
59 std::unique_ptr<DisplayListObserverLock> DisplayList::SuspendObserverUpdates() { 59 std::unique_ptr<DisplayListObserverLock> DisplayList::SuspendObserverUpdates() {
60 return base::WrapUnique(new DisplayListObserverLock(this)); 60 return base::WrapUnique(new DisplayListObserverLock(this));
61 } 61 }
62 62
63 void DisplayList::UpdateDisplay(const display::Display& display) {
64 UpdateDisplay(display, GetTypeByDisplayId(display.id()));
65 }
66
63 void DisplayList::UpdateDisplay(const display::Display& display, Type type) { 67 void DisplayList::UpdateDisplay(const display::Display& display, Type type) {
64 auto iter = FindDisplayById(display.id()); 68 auto iter = FindDisplayById(display.id());
65 DCHECK(iter != displays_.end()); 69 DCHECK(iter != displays_.end());
66 70
67 display::Display* local_display = &(*iter); 71 display::Display* local_display = &(*iter);
68 uint32_t changed_values = 0; 72 uint32_t changed_values = 0;
69 if (type == Type::PRIMARY && 73 if (type == Type::PRIMARY &&
70 static_cast<int>(iter - displays_.begin()) != 74 static_cast<int>(iter - displays_.begin()) !=
71 static_cast<int>(GetPrimaryDisplayIterator() - displays_.begin())) { 75 static_cast<int>(GetPrimaryDisplayIterator() - displays_.begin())) {
72 primary_display_index_ = static_cast<int>(iter - displays_.begin()); 76 primary_display_index_ = static_cast<int>(iter - displays_.begin());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 134
131 void DisplayList::IncrementObserverSuspendLockCount() { 135 void DisplayList::IncrementObserverSuspendLockCount() {
132 observer_suspend_lock_count_++; 136 observer_suspend_lock_count_++;
133 } 137 }
134 138
135 void DisplayList::DecrementObserverSuspendLockCount() { 139 void DisplayList::DecrementObserverSuspendLockCount() {
136 DCHECK_GT(observer_suspend_lock_count_, 0); 140 DCHECK_GT(observer_suspend_lock_count_, 0);
137 observer_suspend_lock_count_--; 141 observer_suspend_lock_count_--;
138 } 142 }
139 143
144 DisplayList::Type DisplayList::GetTypeByDisplayId(int64_t display_id) const {
145 if (primary_display_index_ == -1)
146 return Type::NOT_PRIMARY;
147 return (displays_[primary_display_index_].id() == display_id
148 ? Type::PRIMARY
149 : Type::NOT_PRIMARY);
150 }
151
140 } // namespace display 152 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/display_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698