Chromium Code Reviews| Index: cc/output/overlay_strategy_common.cc |
| diff --git a/cc/output/overlay_strategy_common.cc b/cc/output/overlay_strategy_common.cc |
| index 5d79cd09878555a375dd715f0421b92079738617..dfad68c1edb6dc4470c42b8eafc40240dd6837c4 100644 |
| --- a/cc/output/overlay_strategy_common.cc |
| +++ b/cc/output/overlay_strategy_common.cc |
| @@ -33,18 +33,39 @@ bool OverlayStrategyCommon::Attempt(RenderPassList* render_passes_in_draw_order, |
| RenderPass* root_render_pass = render_passes_in_draw_order->back(); |
| DCHECK(root_render_pass); |
| + // Add our primary surface. |
| + OverlayCandidate main_image; |
| + main_image.display_rect = root_render_pass->output_rect; |
| + DCHECK(candidate_list->empty()); |
| + candidate_list->push_back(main_image); |
| + |
| + bool success = false; |
| QuadList& quad_list = root_render_pass->quad_list; |
| - for (auto it = quad_list.begin(); it != quad_list.end(); ++it) { |
| + for (auto it = quad_list.begin(); it != quad_list.end();) { |
| OverlayCandidate candidate; |
| const DrawQuad* draw_quad = *it; |
| if (IsOverlayQuad(draw_quad) && |
| - GetCandidateQuadInfo(*draw_quad, &candidate) && |
| - delegate_->TryOverlay(capability_checker_, render_passes_in_draw_order, |
| - candidate_list, candidate, it, |
| - device_scale_factor)) |
| - return true; |
| + GetCandidateQuadInfo(*draw_quad, &candidate)) { |
| + OverlayResult result = delegate_->TryOverlay( |
| + capability_checker_, render_passes_in_draw_order, candidate_list, |
| + candidate, &it, device_scale_factor); |
| + if (result == CREATED_OVERLAY_STOP_LOOKING) { |
|
alexst (slow to review)
2015/09/04 17:53:57
Actually, one more thought, we don't handle DID_NO
Andre
2015/09/08 16:55:36
Done.
The combination of continue (for the loop) a
|
| + success = true; |
| + break; |
| + } else if (result == CREATED_OVERLAY_KEEP_LOOKING) { |
| + success = true; |
| + continue; |
| + } |
| + } |
| + ++it; |
| } |
| - return false; |
| + |
| + if (!success) { |
| + DCHECK_EQ(1u, candidate_list->size()); |
| + candidate_list->clear(); |
| + } |
| + |
| + return success; |
| } |
| bool OverlayStrategyCommon::IsOverlayQuad(const DrawQuad* draw_quad) { |