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

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

Issue 2904993003: chromeos: changes how DisplayManagerObservers are notified (Closed)
Patch Set: cleanup Created 3 years, 6 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 const { 45 const {
46 return primary_display_index_ == -1 46 return primary_display_index_ == -1
47 ? displays_.end() 47 ? displays_.end()
48 : displays_.begin() + primary_display_index_; 48 : displays_.begin() + primary_display_index_;
49 } 49 }
50 50
51 std::unique_ptr<DisplayListObserverLock> DisplayList::SuspendObserverUpdates() { 51 std::unique_ptr<DisplayListObserverLock> DisplayList::SuspendObserverUpdates() {
52 return base::WrapUnique(new DisplayListObserverLock(this)); 52 return base::WrapUnique(new DisplayListObserverLock(this));
53 } 53 }
54 54
55 void DisplayList::AddOrUpdateDisplay(const Display& display, Type type) {
56 if (FindDisplayById(display.id()) == displays_.end())
57 AddDisplay(display, type);
58 else
59 UpdateDisplay(display, type);
60 }
61
55 uint32_t DisplayList::UpdateDisplay(const Display& display) { 62 uint32_t DisplayList::UpdateDisplay(const Display& display) {
56 return UpdateDisplay(display, GetTypeByDisplayId(display.id())); 63 return UpdateDisplay(display, GetTypeByDisplayId(display.id()));
57 } 64 }
58 65
59 uint32_t DisplayList::UpdateDisplay(const Display& display, Type type) { 66 uint32_t DisplayList::UpdateDisplay(const Display& display, Type type) {
60 auto iter = FindDisplayByIdInternal(display.id()); 67 auto iter = FindDisplayByIdInternal(display.id());
61 DCHECK(iter != displays_.end()); 68 DCHECK(iter != displays_.end());
62 69
63 Display* local_display = &(*iter); 70 Display* local_display = &(*iter);
64 uint32_t changed_values = 0; 71 uint32_t changed_values = 0;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 DisplayList::Displays::iterator DisplayList::FindDisplayByIdInternal( 151 DisplayList::Displays::iterator DisplayList::FindDisplayByIdInternal(
145 int64_t id) { 152 int64_t id) {
146 for (auto iter = displays_.begin(); iter != displays_.end(); ++iter) { 153 for (auto iter = displays_.begin(); iter != displays_.end(); ++iter) {
147 if (iter->id() == id) 154 if (iter->id() == id)
148 return iter; 155 return iter;
149 } 156 }
150 return displays_.end(); 157 return displays_.end();
151 } 158 }
152 159
153 } // namespace display 160 } // 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