Index: ui/ozone/platform/drm/gpu/hardware_display_controller.cc |
diff --git a/ui/ozone/platform/drm/gpu/hardware_display_controller.cc b/ui/ozone/platform/drm/gpu/hardware_display_controller.cc |
index 1b503c558f8bb440ca8b894bc44d00b643f778c0..09d60a96fe0b8dc9bc5fa402e677b845a4357a71 100644 |
--- a/ui/ozone/platform/drm/gpu/hardware_display_controller.cc |
+++ b/ui/ozone/platform/drm/gpu/hardware_display_controller.cc |
@@ -47,8 +47,8 @@ bool HardwareDisplayController::Modeset(const OverlayPlane& primary, |
TRACE_EVENT0("drm", "HDC::Modeset"); |
DCHECK(primary.buffer.get()); |
bool status = true; |
- for (size_t i = 0; i < crtc_controllers_.size(); ++i) |
- status &= crtc_controllers_[i]->Modeset(primary, mode); |
+ for (const auto& controller : crtc_controllers_) |
+ status &= controller->Modeset(primary, mode); |
is_disabled_ = false; |
@@ -59,10 +59,8 @@ bool HardwareDisplayController::Enable(const OverlayPlane& primary) { |
TRACE_EVENT0("drm", "HDC::Enable"); |
DCHECK(primary.buffer.get()); |
bool status = true; |
- for (size_t i = 0; i < crtc_controllers_.size(); ++i) { |
- status &= |
- crtc_controllers_[i]->Modeset(primary, crtc_controllers_[i]->mode()); |
- } |
+ for (const auto& controller : crtc_controllers_) |
+ status &= controller->Modeset(primary, controller->mode()); |
is_disabled_ = false; |
@@ -71,9 +69,8 @@ bool HardwareDisplayController::Enable(const OverlayPlane& primary) { |
void HardwareDisplayController::Disable() { |
TRACE_EVENT0("drm", "HDC::Disable"); |
- for (size_t i = 0; i < crtc_controllers_.size(); ++i) |
- crtc_controllers_[i]->Disable(); |
- |
+ for (const auto& controller : crtc_controllers_) |
+ controller->Disable(); |
is_disabled_ = true; |
} |
@@ -121,10 +118,10 @@ bool HardwareDisplayController::ActualSchedulePageFlip( |
planes.first->plane_manager()->BeginFrame(planes.second); |
bool status = true; |
- for (size_t i = 0; i < crtc_controllers_.size(); ++i) { |
- status &= crtc_controllers_[i]->SchedulePageFlip( |
- owned_hardware_planes_.get(crtc_controllers_[i]->drm().get()), |
- pending_planes, test_only, page_flip_request); |
+ for (const auto& controller : crtc_controllers_) { |
+ status &= controller->SchedulePageFlip( |
+ owned_hardware_planes_.get(controller->drm().get()), pending_planes, |
+ test_only, page_flip_request); |
} |
for (const auto& planes : owned_hardware_planes_) { |
@@ -163,16 +160,16 @@ bool HardwareDisplayController::SetCursor( |
if (is_disabled_) |
return true; |
- for (size_t i = 0; i < crtc_controllers_.size(); ++i) |
- status &= crtc_controllers_[i]->SetCursor(buffer); |
+ for (const auto& controller : crtc_controllers_) |
+ status &= controller->SetCursor(buffer); |
return status; |
} |
bool HardwareDisplayController::UnsetCursor() { |
bool status = true; |
- for (size_t i = 0; i < crtc_controllers_.size(); ++i) |
- status &= crtc_controllers_[i]->SetCursor(nullptr); |
+ for (const auto& controller : crtc_controllers_) |
+ status &= controller->SetCursor(nullptr); |
return status; |
} |
@@ -182,8 +179,8 @@ bool HardwareDisplayController::MoveCursor(const gfx::Point& location) { |
return true; |
bool status = true; |
- for (size_t i = 0; i < crtc_controllers_.size(); ++i) |
- status &= crtc_controllers_[i]->MoveCursor(location); |
+ for (const auto& controller : crtc_controllers_) |
+ status &= controller->MoveCursor(location); |
return status; |
} |
@@ -194,14 +191,14 @@ void HardwareDisplayController::AddCrtc(scoped_ptr<CrtcController> controller) { |
new HardwareDisplayPlaneList())); |
// Check if this controller owns any planes and ensure we keep track of them. |
- const ScopedVector<HardwareDisplayPlane>& all_planes = |
+ const std::vector<scoped_ptr<HardwareDisplayPlane>>& all_planes = |
drm->plane_manager()->planes(); |
HardwareDisplayPlaneList* crtc_plane_list = |
owned_hardware_planes_.get(drm.get()); |
uint32_t crtc = controller->crtc(); |
- for (auto* plane : all_planes) { |
+ for (const auto& plane : all_planes) { |
if (plane->in_use() && (plane->owning_crtc() == crtc)) |
- crtc_plane_list->old_plane_list.push_back(plane); |
+ crtc_plane_list->old_plane_list.push_back(plane.get()); |
} |
crtc_controllers_.push_back(controller.Pass()); |
@@ -210,16 +207,16 @@ void HardwareDisplayController::AddCrtc(scoped_ptr<CrtcController> controller) { |
scoped_ptr<CrtcController> HardwareDisplayController::RemoveCrtc( |
const scoped_refptr<DrmDevice>& drm, |
uint32_t crtc) { |
- for (ScopedVector<CrtcController>::iterator it = crtc_controllers_.begin(); |
- it != crtc_controllers_.end(); ++it) { |
+ for (auto it = crtc_controllers_.begin(); it != crtc_controllers_.end(); |
+ ++it) { |
if ((*it)->drm() == drm && (*it)->crtc() == crtc) { |
- scoped_ptr<CrtcController> controller(*it); |
- crtc_controllers_.weak_erase(it); |
+ scoped_ptr<CrtcController> controller(std::move(*it)); |
+ crtc_controllers_.erase(it); |
+ |
// Remove entry from |owned_hardware_planes_| iff no other crtcs share it. |
bool found = false; |
- for (ScopedVector<CrtcController>::iterator it = |
- crtc_controllers_.begin(); |
- it != crtc_controllers_.end(); ++it) { |
+ for (auto it = crtc_controllers_.begin(); it != crtc_controllers_.end(); |
+ ++it) { |
if ((*it)->drm() == controller->drm()) { |
found = true; |
break; |
@@ -247,10 +244,10 @@ scoped_ptr<CrtcController> HardwareDisplayController::RemoveCrtc( |
bool HardwareDisplayController::HasCrtc(const scoped_refptr<DrmDevice>& drm, |
uint32_t crtc) const { |
- for (size_t i = 0; i < crtc_controllers_.size(); ++i) |
- if (crtc_controllers_[i]->drm() == drm && |
- crtc_controllers_[i]->crtc() == crtc) |
+ for (const auto& controller : crtc_controllers_) { |
+ if (controller->drm() == drm && controller->crtc() == crtc) |
return true; |
+ } |
return false; |
} |
@@ -271,9 +268,10 @@ gfx::Size HardwareDisplayController::GetModeSize() const { |
uint64_t HardwareDisplayController::GetTimeOfLastFlip() const { |
uint64_t time = 0; |
- for (size_t i = 0; i < crtc_controllers_.size(); ++i) |
- if (time < crtc_controllers_[i]->time_of_last_flip()) |
- time = crtc_controllers_[i]->time_of_last_flip(); |
+ for (const auto& controller : crtc_controllers_) { |
+ if (time < controller->time_of_last_flip()) |
+ time = controller->time_of_last_flip(); |
+ } |
return time; |
} |