| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/compositor_frame_sink_support.h" | 5 #include "cc/surfaces/compositor_frame_sink_support.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 SurfaceReference reference(surface_manager_->GetRootSurfaceId(), surface_id); | 127 SurfaceReference reference(surface_manager_->GetRootSurfaceId(), surface_id); |
| 128 surface_manager_->RemoveSurfaceReferences({reference}); | 128 surface_manager_->RemoveSurfaceReferences({reference}); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void CompositorFrameSinkSupport::DidReceiveCompositorFrameAck() { | 131 void CompositorFrameSinkSupport::DidReceiveCompositorFrameAck() { |
| 132 DCHECK_GT(ack_pending_count_, 0); | 132 DCHECK_GT(ack_pending_count_, 0); |
| 133 ack_pending_count_--; | 133 ack_pending_count_--; |
| 134 | 134 |
| 135 if (!client_) | 135 if (!client_) |
| 136 return; | 136 return; |
| 137 client_->DidReceiveCompositorFrameAck(); | 137 |
| 138 // We return the resources before sending an ack so they can be reused in |
| 139 // making the next CompositorFrame. |
| 138 if (!surface_returned_resources_.empty()) { | 140 if (!surface_returned_resources_.empty()) { |
| 139 client_->ReclaimResources(surface_returned_resources_); | 141 client_->ReclaimResources(surface_returned_resources_); |
| 140 surface_returned_resources_.clear(); | 142 surface_returned_resources_.clear(); |
| 141 } | 143 } |
| 144 client_->DidReceiveCompositorFrameAck(); |
| 142 } | 145 } |
| 143 | 146 |
| 144 void CompositorFrameSinkSupport::ForceReclaimResources() { | 147 void CompositorFrameSinkSupport::ForceReclaimResources() { |
| 145 surface_factory_.ClearSurface(); | 148 surface_factory_.ClearSurface(); |
| 146 } | 149 } |
| 147 | 150 |
| 148 void CompositorFrameSinkSupport::ClaimTemporaryReference( | 151 void CompositorFrameSinkSupport::ClaimTemporaryReference( |
| 149 const SurfaceId& surface_id) { | 152 const SurfaceId& surface_id) { |
| 150 surface_manager_->AssignTemporaryReference(surface_id, frame_sink_id_); | 153 surface_manager_->AssignTemporaryReference(surface_id, frame_sink_id_); |
| 151 } | 154 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 else | 231 else |
| 229 begin_frame_source_->RemoveObserver(this); | 232 begin_frame_source_->RemoveObserver(this); |
| 230 } | 233 } |
| 231 | 234 |
| 232 void CompositorFrameSinkSupport::RequestCopyOfSurface( | 235 void CompositorFrameSinkSupport::RequestCopyOfSurface( |
| 233 std::unique_ptr<CopyOutputRequest> request) { | 236 std::unique_ptr<CopyOutputRequest> request) { |
| 234 surface_factory_.RequestCopyOfSurface(std::move(request)); | 237 surface_factory_.RequestCopyOfSurface(std::move(request)); |
| 235 } | 238 } |
| 236 | 239 |
| 237 } // namespace cc | 240 } // namespace cc |
| OLD | NEW |