Index: ui/ozone/platform/dri/chromeos/native_display_delegate_dri.cc |
diff --git a/ui/ozone/platform/dri/chromeos/native_display_delegate_dri.cc b/ui/ozone/platform/dri/chromeos/native_display_delegate_dri.cc |
index 02817f9d7d79f5458dc97828a2fa5536317607cd..17f582ce013455e12ea840f4e4bb41d668cd8a38 100644 |
--- a/ui/ozone/platform/dri/chromeos/native_display_delegate_dri.cc |
+++ b/ui/ozone/platform/dri/chromeos/native_display_delegate_dri.cc |
@@ -51,23 +51,6 @@ |
NOTREACHED(); |
return 0; |
} |
- |
-class DisplaySnapshotComparator { |
- public: |
- DisplaySnapshotComparator(const DisplaySnapshotDri* snapshot) |
- : snapshot_(snapshot) {} |
- |
- bool operator()(const DisplaySnapshotDri* other) const { |
- if (snapshot_->connector() == other->connector() && |
- snapshot_->crtc() == other->crtc()) |
- return true; |
- |
- return false; |
- } |
- |
- private: |
- const DisplaySnapshotDri* snapshot_; |
-}; |
} // namespace |
@@ -305,25 +288,18 @@ |
const std::vector<DisplaySnapshotDri*>& new_displays, |
const std::vector<DisplaySnapshotDri*>& old_displays) const { |
for (size_t i = 0; i < old_displays.size(); ++i) { |
- const std::vector<DisplaySnapshotDri*>::const_iterator it = |
- std::find_if(new_displays.begin(), |
- new_displays.end(), |
- DisplaySnapshotComparator(old_displays[i])); |
- |
- if (it == new_displays.end()) |
+ bool found = false; |
+ for (size_t j = 0; j < new_displays.size(); ++j) { |
+ if (old_displays[i]->connector() == new_displays[j]->connector() && |
+ old_displays[i]->crtc() == new_displays[j]->crtc()) { |
+ found = true; |
+ break; |
+ } |
+ } |
+ |
+ if (!found) |
screen_manager_->RemoveDisplayController(old_displays[i]->crtc()); |
} |
- |
- for (size_t i = 0; i < new_displays.size(); ++i) { |
- const std::vector<DisplaySnapshotDri*>::const_iterator it = |
- std::find_if(old_displays.begin(), |
- old_displays.end(), |
- DisplaySnapshotComparator(new_displays[i])); |
- |
- if (it == old_displays.end()) |
- screen_manager_->AddDisplayController(new_displays[i]->crtc(), |
- new_displays[i]->connector()); |
- } |
} |
} // namespace ui |