| Index: cc/surfaces/surface_aggregator.cc
|
| diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
|
| index 35107e8363adf32ffef983cc32801b5e4d481163..0df781f2dc62d0dbaf0c48afca03beae44e83f8c 100644
|
| --- a/cc/surfaces/surface_aggregator.cc
|
| +++ b/cc/surfaces/surface_aggregator.cc
|
| @@ -170,17 +170,22 @@ void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
|
| if (!frame_data)
|
| return;
|
|
|
| + ScopedPtrVector<ScopedPtrVector<CopyOutputRequest>> copy_requests;
|
| + surface->TakeCopyOutputRequests(©_requests);
|
| +
|
| RenderPassList render_pass_list;
|
| bool invalid_frame = TakeResources(surface, frame_data, &render_pass_list);
|
| - if (invalid_frame)
|
| + if (invalid_frame) {
|
| + for (auto* request_list : copy_requests) {
|
| + for (auto* request : *request_list)
|
| + request->SendEmptyResult();
|
| + }
|
| return;
|
| + }
|
|
|
| SurfaceSet::iterator it = referenced_surfaces_.insert(surface_id).first;
|
|
|
| - ScopedPtrVector<CopyOutputRequest> copy_requests;
|
| - surface->TakeCopyOutputRequests(©_requests);
|
| -
|
| - bool merge_pass = copy_requests.empty();
|
| + bool merge_pass = copy_requests.back()->empty();
|
|
|
| const RenderPassList& referenced_passes = render_pass_list;
|
| size_t passes_to_copy =
|
| @@ -198,6 +203,8 @@ void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
|
| source.transform_to_root_target,
|
| source.has_transparent_background);
|
|
|
| + copy_pass->copy_requests.swap(*copy_requests[j]);
|
| +
|
| // Contributing passes aggregated in to the pass list need to take the
|
| // transform of the surface quad into account to update their transform to
|
| // the root surface.
|
| @@ -229,8 +236,6 @@ void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
|
| } else {
|
| RenderPassId remapped_pass_id = RemapPassId(last_pass.id, surface_id);
|
|
|
| - dest_pass_list_->back()->copy_requests.swap(copy_requests);
|
| -
|
| SharedQuadState* shared_quad_state =
|
| dest_pass->CreateAndAppendSharedQuadState();
|
| shared_quad_state->CopyFrom(surface_quad->shared_quad_state);
|
| @@ -323,13 +328,25 @@ void SurfaceAggregator::CopyQuadsToPass(
|
| }
|
| }
|
|
|
| -void SurfaceAggregator::CopyPasses(const RenderPassList& source_pass_list,
|
| - const Surface* surface) {
|
| +void SurfaceAggregator::CopyPasses(const DelegatedFrameData* frame_data,
|
| + Surface* surface) {
|
| + RenderPassList source_pass_list;
|
| +
|
| + // The root surface is allowed to have copy output requests, so grab them
|
| + // off its render passes.
|
| + ScopedPtrVector<ScopedPtrVector<CopyOutputRequest>> output_requests;
|
| + surface->TakeCopyOutputRequests(&output_requests);
|
| +
|
| + bool invalid_frame = TakeResources(surface, frame_data, &source_pass_list);
|
| + DCHECK(!invalid_frame);
|
| +
|
| for (size_t i = 0; i < source_pass_list.size(); ++i) {
|
| const RenderPass& source = *source_pass_list[i];
|
|
|
| scoped_ptr<RenderPass> copy_pass(RenderPass::Create());
|
|
|
| + copy_pass->copy_requests.swap(*output_requests[i]);
|
| +
|
| RenderPassId remapped_pass_id =
|
| RemapPassId(source.id, surface->surface_id());
|
|
|
| @@ -363,20 +380,12 @@ scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate(SurfaceId surface_id) {
|
|
|
| DCHECK(root_surface_frame->delegated_frame_data);
|
|
|
| - RenderPassList source_pass_list;
|
| -
|
| SurfaceSet::iterator it = referenced_surfaces_.insert(surface_id).first;
|
|
|
| dest_resource_list_ = &frame->delegated_frame_data->resource_list;
|
| dest_pass_list_ = &frame->delegated_frame_data->render_pass_list;
|
|
|
| - bool invalid_frame =
|
| - TakeResources(surface,
|
| - root_surface_frame->delegated_frame_data.get(),
|
| - &source_pass_list);
|
| - DCHECK(!invalid_frame);
|
| -
|
| - CopyPasses(source_pass_list, surface);
|
| + CopyPasses(root_surface_frame->delegated_frame_data.get(), surface);
|
|
|
| referenced_surfaces_.erase(it);
|
| DCHECK(referenced_surfaces_.empty());
|
|
|