| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/surfaces/surface.h" | 5 #include "cc/surfaces/surface.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, | 40 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, |
| 41 const DrawCallback& callback) { | 41 const DrawCallback& callback) { |
| 42 DCHECK(factory_); | 42 DCHECK(factory_); |
| 43 ClearCopyRequests(); | 43 ClearCopyRequests(); |
| 44 TakeLatencyInfo(&frame->metadata.latency_info); | 44 TakeLatencyInfo(&frame->metadata.latency_info); |
| 45 scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass(); | 45 scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass(); |
| 46 current_frame_ = frame.Pass(); | 46 current_frame_ = frame.Pass(); |
| 47 factory_->ReceiveFromChild( | 47 factory_->ReceiveFromChild( |
| 48 current_frame_->delegated_frame_data->resource_list); | 48 current_frame_->delegated_frame_data->resource_list); |
| 49 ++frame_index_; | 49 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't |
| 50 // increment frame index for them. |
| 51 if (!current_frame_ || |
| 52 !current_frame_->delegated_frame_data->render_pass_list.empty()) |
| 53 ++frame_index_; |
| 50 | 54 |
| 51 if (previous_frame) { | 55 if (previous_frame) { |
| 52 ReturnedResourceArray previous_resources; | 56 ReturnedResourceArray previous_resources; |
| 53 TransferableResource::ReturnResources( | 57 TransferableResource::ReturnResources( |
| 54 previous_frame->delegated_frame_data->resource_list, | 58 previous_frame->delegated_frame_data->resource_list, |
| 55 &previous_resources); | 59 &previous_resources); |
| 56 factory_->UnrefResources(previous_resources); | 60 factory_->UnrefResources(previous_resources); |
| 57 } | 61 } |
| 58 if (!draw_callback_.is_null()) | 62 if (!draw_callback_.is_null()) |
| 59 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED); | 63 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 if (current_frame_) { | 135 if (current_frame_) { |
| 132 for (const auto& render_pass : | 136 for (const auto& render_pass : |
| 133 current_frame_->delegated_frame_data->render_pass_list) { | 137 current_frame_->delegated_frame_data->render_pass_list) { |
| 134 for (const auto& copy_request : render_pass->copy_requests) | 138 for (const auto& copy_request : render_pass->copy_requests) |
| 135 copy_request->SendEmptyResult(); | 139 copy_request->SendEmptyResult(); |
| 136 } | 140 } |
| 137 } | 141 } |
| 138 } | 142 } |
| 139 | 143 |
| 140 } // namespace cc | 144 } // namespace cc |
| OLD | NEW |