| Index: ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc
|
| diff --git a/ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc b/ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc
|
| index 4a678d9a33bac99cfb9b7ae6b42641ccf42e7b05..44e8cf543ea33e6fc77d7215f3cfb9c1f1a7320f 100644
|
| --- a/ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc
|
| +++ b/ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc
|
| @@ -28,7 +28,7 @@ class DisplayComparator {
|
| uint32_t connector)
|
| : drm_(drm), crtc_(crtc), connector_(connector) {}
|
|
|
| - bool operator()(const DrmDisplay* other) const {
|
| + bool operator()(const scoped_ptr<DrmDisplay>& other) const {
|
| return drm_ == other->drm() && connector_ == other->connector() &&
|
| crtc_ == other->crtc();
|
| }
|
| @@ -66,7 +66,8 @@ DrmGpuDisplayManager::~DrmGpuDisplayManager() {
|
| }
|
|
|
| std::vector<DisplaySnapshot_Params> DrmGpuDisplayManager::GetDisplays() {
|
| - ScopedVector<DrmDisplay> old_displays(displays_.Pass());
|
| + std::vector<scoped_ptr<DrmDisplay>> old_displays;
|
| + old_displays.swap(displays_);
|
| std::vector<DisplaySnapshot_Params> params_list;
|
|
|
| const DrmDeviceVector& devices = drm_device_manager_->GetDrmDevices();
|
| @@ -80,10 +81,11 @@ std::vector<DisplaySnapshot_Params> DrmGpuDisplayManager::GetDisplays() {
|
| DisplayComparator(drm, display_info->crtc()->crtc_id,
|
| display_info->connector()->connector_id));
|
| if (it != old_displays.end()) {
|
| - displays_.push_back(*it);
|
| - old_displays.weak_erase(it);
|
| + displays_.push_back(std::move(*it));
|
| + old_displays.erase(it);
|
| } else {
|
| - displays_.push_back(new DrmDisplay(screen_manager_, drm));
|
| + displays_.push_back(
|
| + make_scoped_ptr(new DrmDisplay(screen_manager_, drm)));
|
| }
|
| params_list.push_back(
|
| displays_.back()->Update(display_info, device_index));
|
| @@ -91,7 +93,7 @@ std::vector<DisplaySnapshot_Params> DrmGpuDisplayManager::GetDisplays() {
|
| device_index++;
|
| }
|
|
|
| - NotifyScreenManager(displays_.get(), old_displays.get());
|
| + NotifyScreenManager(displays_, old_displays);
|
| return params_list;
|
| }
|
|
|
| @@ -133,8 +135,8 @@ bool DrmGpuDisplayManager::ConfigureDisplay(
|
| // other displays and try using it on the current display (some displays
|
| // support panel fitting and they can use different modes even if the mode
|
| // isn't explicitly declared).
|
| - for (DrmDisplay* other : displays_) {
|
| - mode_found = FindMatchingMode(other->modes(), mode_param, &mode);
|
| + for (const auto& other_display : displays_) {
|
| + mode_found = FindMatchingMode(other_display->modes(), mode_param, &mode);
|
| if (mode_found)
|
| break;
|
| }
|
| @@ -193,36 +195,34 @@ void DrmGpuDisplayManager::SetGammaRamp(
|
| }
|
|
|
| DrmDisplay* DrmGpuDisplayManager::FindDisplay(int64_t display_id) {
|
| - for (DrmDisplay* display : displays_)
|
| + for (const auto& display : displays_) {
|
| if (display->display_id() == display_id)
|
| - return display;
|
| + return display.get();
|
| + }
|
|
|
| return nullptr;
|
| }
|
|
|
| void DrmGpuDisplayManager::NotifyScreenManager(
|
| - const std::vector<DrmDisplay*>& new_displays,
|
| - const std::vector<DrmDisplay*>& old_displays) const {
|
| - for (size_t i = 0; i < old_displays.size(); ++i) {
|
| - const std::vector<DrmDisplay*>::const_iterator it =
|
| - std::find_if(new_displays.begin(), new_displays.end(),
|
| - DisplayComparator(old_displays[i]));
|
| + const std::vector<scoped_ptr<DrmDisplay>>& new_displays,
|
| + const std::vector<scoped_ptr<DrmDisplay>>& old_displays) const {
|
| + for (const auto& old_display : old_displays) {
|
| + auto it = std::find_if(new_displays.begin(), new_displays.end(),
|
| + DisplayComparator(old_display.get()));
|
|
|
| if (it == new_displays.end()) {
|
| - screen_manager_->RemoveDisplayController(old_displays[i]->drm(),
|
| - old_displays[i]->crtc());
|
| + screen_manager_->RemoveDisplayController(old_display->drm(),
|
| + old_display->crtc());
|
| }
|
| }
|
|
|
| - for (size_t i = 0; i < new_displays.size(); ++i) {
|
| - const std::vector<DrmDisplay*>::const_iterator it =
|
| - std::find_if(old_displays.begin(), old_displays.end(),
|
| - DisplayComparator(new_displays[i]));
|
| + for (const auto& new_display : new_displays) {
|
| + auto it = std::find_if(old_displays.begin(), old_displays.end(),
|
| + DisplayComparator(new_display.get()));
|
|
|
| if (it == old_displays.end()) {
|
| - screen_manager_->AddDisplayController(new_displays[i]->drm(),
|
| - new_displays[i]->crtc(),
|
| - new_displays[i]->connector());
|
| + screen_manager_->AddDisplayController(
|
| + new_display->drm(), new_display->crtc(), new_display->connector());
|
| }
|
| }
|
| }
|
|
|