Index: cc/quads/render_pass.cc |
diff --git a/cc/quads/render_pass.cc b/cc/quads/render_pass.cc |
index 9b9e0b21ac1c0b408a3af712a0317116641bf57e..021352866802d152b287e7c0868b533625e6c989 100644 |
--- a/cc/quads/render_pass.cc |
+++ b/cc/quads/render_pass.cc |
@@ -98,51 +98,50 @@ std::unique_ptr<RenderPass> RenderPass::Copy(RenderPassId new_id) const { |
return copy_pass; |
} |
-// static |
-void RenderPass::CopyAll(const std::vector<std::unique_ptr<RenderPass>>& in, |
- std::vector<std::unique_ptr<RenderPass>>* out) { |
- for (const auto& source : in) { |
- // Since we can't copy these, it's wrong to use CopyAll in a situation where |
- // you may have copy_requests present. |
- DCHECK_EQ(source->copy_requests.size(), 0u); |
- |
- std::unique_ptr<RenderPass> copy_pass(Create( |
- source->shared_quad_state_list.size(), source->quad_list.size())); |
- copy_pass->SetAll(source->id, |
- source->output_rect, |
- source->damage_rect, |
- source->transform_to_root_target, |
- source->has_transparent_background); |
- for (auto* shared_quad_state : source->shared_quad_state_list) { |
- SharedQuadState* copy_shared_quad_state = |
- copy_pass->CreateAndAppendSharedQuadState(); |
- *copy_shared_quad_state = *shared_quad_state; |
+std::unique_ptr<RenderPass> RenderPass::DeepCopy() const { |
+ // Since we can't copy these, it's wrong to use DeepCopy in a situation where |
+ // you may have copy_requests present. |
+ DCHECK_EQ(copy_requests.size(), 0u); |
+ |
+ std::unique_ptr<RenderPass> copy_pass( |
+ Create(shared_quad_state_list.size(), quad_list.size())); |
+ copy_pass->SetAll(id, output_rect, damage_rect, transform_to_root_target, |
+ has_transparent_background); |
+ for (auto* shared_quad_state : shared_quad_state_list) { |
+ SharedQuadState* copy_shared_quad_state = |
+ copy_pass->CreateAndAppendSharedQuadState(); |
+ *copy_shared_quad_state = *shared_quad_state; |
+ } |
+ SharedQuadStateList::ConstIterator sqs_iter = shared_quad_state_list.begin(); |
+ SharedQuadStateList::Iterator copy_sqs_iter = |
+ copy_pass->shared_quad_state_list.begin(); |
+ for (auto* quad : quad_list) { |
+ while (quad->shared_quad_state != *sqs_iter) { |
+ ++sqs_iter; |
+ ++copy_sqs_iter; |
+ DCHECK(sqs_iter != shared_quad_state_list.end()); |
} |
- SharedQuadStateList::Iterator sqs_iter = |
- source->shared_quad_state_list.begin(); |
- SharedQuadStateList::Iterator copy_sqs_iter = |
- copy_pass->shared_quad_state_list.begin(); |
- for (auto* quad : source->quad_list) { |
- while (quad->shared_quad_state != *sqs_iter) { |
- ++sqs_iter; |
- ++copy_sqs_iter; |
- DCHECK(sqs_iter != source->shared_quad_state_list.end()); |
- } |
- DCHECK(quad->shared_quad_state == *sqs_iter); |
- |
- SharedQuadState* copy_shared_quad_state = *copy_sqs_iter; |
- |
- if (quad->material == DrawQuad::RENDER_PASS) { |
- const RenderPassDrawQuad* pass_quad = |
- RenderPassDrawQuad::MaterialCast(quad); |
- copy_pass->CopyFromAndAppendRenderPassDrawQuad( |
- pass_quad, copy_shared_quad_state, pass_quad->render_pass_id); |
- } else { |
- copy_pass->CopyFromAndAppendDrawQuad(quad, copy_shared_quad_state); |
- } |
+ DCHECK(quad->shared_quad_state == *sqs_iter); |
+ |
+ SharedQuadState* copy_shared_quad_state = *copy_sqs_iter; |
+ |
+ if (quad->material == DrawQuad::RENDER_PASS) { |
+ const RenderPassDrawQuad* pass_quad = |
+ RenderPassDrawQuad::MaterialCast(quad); |
+ copy_pass->CopyFromAndAppendRenderPassDrawQuad( |
+ pass_quad, copy_shared_quad_state, pass_quad->render_pass_id); |
+ } else { |
+ copy_pass->CopyFromAndAppendDrawQuad(quad, copy_shared_quad_state); |
} |
- out->push_back(std::move(copy_pass)); |
} |
+ return copy_pass; |
+} |
+ |
+// static |
+void RenderPass::CopyAll(const std::vector<std::unique_ptr<RenderPass>>& in, |
+ std::vector<std::unique_ptr<RenderPass>>* out) { |
+ for (const auto& source : in) |
+ out->push_back(source->DeepCopy()); |
} |
void RenderPass::SetNew(RenderPassId id, |