| Index: cc/surfaces/surface.cc
|
| diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
|
| index d58ed4cc18046fbc667d7490d011436a3cff5a86..b3be169c2f7db77377d79613af172afa7981513d 100644
|
| --- a/cc/surfaces/surface.cc
|
| +++ b/cc/surfaces/surface.cc
|
| @@ -22,12 +22,7 @@ Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory)
|
| }
|
|
|
| Surface::~Surface() {
|
| - for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin();
|
| - it != copy_requests_.end();
|
| - ++it) {
|
| - (*it)->SendEmptyResult();
|
| - }
|
| - copy_requests_.clear();
|
| + ClearCopyRequests();
|
| if (current_frame_) {
|
| ReturnedResourceArray current_resources;
|
| TransferableResource::ReturnResources(
|
| @@ -39,13 +34,7 @@ Surface::~Surface() {
|
|
|
| void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame,
|
| const base::Closure& callback) {
|
| - for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin();
|
| - it != copy_requests_.end();
|
| - ++it) {
|
| - (*it)->SendEmptyResult();
|
| - }
|
| - copy_requests_.clear();
|
| -
|
| + ClearCopyRequests();
|
| TakeLatencyInfo(&frame->metadata.latency_info);
|
| scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass();
|
| current_frame_ = frame.Pass();
|
| @@ -66,13 +55,25 @@ void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame,
|
| }
|
|
|
| void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) {
|
| - copy_requests_.push_back(copy_request.Pass());
|
| + if (current_frame_ &&
|
| + !current_frame_->delegated_frame_data->render_pass_list.empty())
|
| + current_frame_->delegated_frame_data->render_pass_list.back()
|
| + ->copy_requests.push_back(copy_request.Pass());
|
| + else
|
| + copy_request->SendEmptyResult();
|
| }
|
|
|
| void Surface::TakeCopyOutputRequests(
|
| - ScopedPtrVector<CopyOutputRequest>* copy_requests) {
|
| + ScopedPtrVector<ScopedPtrVector<CopyOutputRequest>>* copy_requests) {
|
| DCHECK(copy_requests->empty());
|
| - copy_requests->swap(copy_requests_);
|
| + if (current_frame_) {
|
| + for (auto* render_pass :
|
| + current_frame_->delegated_frame_data->render_pass_list) {
|
| + copy_requests->push_back(
|
| + make_scoped_ptr(new ScopedPtrVector<CopyOutputRequest>()));
|
| + copy_requests->back()->swap(render_pass->copy_requests);
|
| + }
|
| + }
|
| }
|
|
|
| const CompositorFrame* Surface::GetEligibleFrame() {
|
| @@ -100,4 +101,14 @@ void Surface::RunDrawCallbacks() {
|
| }
|
| }
|
|
|
| +void Surface::ClearCopyRequests() {
|
| + if (current_frame_) {
|
| + for (auto* render_pass :
|
| + current_frame_->delegated_frame_data->render_pass_list) {
|
| + for (auto* copy_request : render_pass->copy_requests)
|
| + copy_request->SendEmptyResult();
|
| + }
|
| + }
|
| +}
|
| +
|
| } // namespace cc
|
|
|