summaryrefslogtreecommitdiffstats
path: root/cc/surfaces
diff options
context:
space:
mode:
authorweiliangc <weiliangc@chromium.org>2015-08-26 14:37:14 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-26 21:37:50 +0000
commitfb5c49d876a4846a7df23c4153f12b5c8e1adb33 (patch)
tree5f79429141981bb86852957ca8579597ea8d9644 /cc/surfaces
parenta71f4b24d7c40c56e734af9cb3d5d05965b8d83b (diff)
downloadchromium_src-fb5c49d876a4846a7df23c4153f12b5c8e1adb33.zip
chromium_src-fb5c49d876a4846a7df23c4153f12b5c8e1adb33.tar.gz
chromium_src-fb5c49d876a4846a7df23c4153f12b5c8e1adb33.tar.bz2
cc:Stop incrementing while loop when iterator at the end
Add check for while loop so won't increment iterator when iterator at the end of list. BUG=524580 R=danakj CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1314023002 Cr-Commit-Position: refs/heads/master@{#345685}
Diffstat (limited to 'cc/surfaces')
-rw-r--r--cc/surfaces/surface_aggregator.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index a2b56b5..69618ba 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -330,15 +330,21 @@ void SurfaceAggregator::CopyQuadsToPass(
// transform isn't axis-aligned.
gfx::Rect damage_rect_in_quad_space;
+#if DCHECK_IS_ON()
+ // If quads have come in with SharedQuadState out of order, or when quads have
+ // invalid SharedQuadState pointer, it should DCHECK.
SharedQuadStateList::ConstIterator sqs_iter =
source_shared_quad_state_list.begin();
for (const auto& quad : source_quad_list) {
- while (quad->shared_quad_state != *sqs_iter) {
+ while (sqs_iter != source_shared_quad_state_list.end() &&
+ quad->shared_quad_state != *sqs_iter) {
++sqs_iter;
- DCHECK(sqs_iter != source_shared_quad_state_list.end());
}
- DCHECK_EQ(quad->shared_quad_state, *sqs_iter);
+ DCHECK(sqs_iter != source_shared_quad_state_list.end());
+ }
+#endif
+ for (const auto& quad : source_quad_list) {
if (quad->material == DrawQuad::SURFACE_CONTENT) {
const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad);
// HandleSurfaceQuad may add other shared quad state, so reset the