| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 void CompositorFrameSinkSupport::RemoveTopLevelRootReference( | 206 void CompositorFrameSinkSupport::RemoveTopLevelRootReference( |
| 207 const SurfaceId& surface_id) { | 207 const SurfaceId& surface_id) { |
| 208 SurfaceReference reference(surface_manager_->GetRootSurfaceId(), surface_id); | 208 SurfaceReference reference(surface_manager_->GetRootSurfaceId(), surface_id); |
| 209 surface_manager_->RemoveSurfaceReferences({reference}); | 209 surface_manager_->RemoveSurfaceReferences({reference}); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void CompositorFrameSinkSupport::DidReceiveCompositorFrameAck() { | 212 void CompositorFrameSinkSupport::DidReceiveCompositorFrameAck() { |
| 213 DCHECK_GT(ack_pending_count_, 0); | 213 DCHECK_GT(ack_pending_count_, 0); |
| 214 ack_pending_count_--; | 214 ack_pending_count_--; |
| 215 | |
| 216 if (!client_) | 215 if (!client_) |
| 217 return; | 216 return; |
| 218 | 217 client_->DidReceiveCompositorFrameAck(surface_returned_resources_); |
| 219 // We return the resources before sending an ack so they can be reused in | 218 surface_returned_resources_.clear(); |
| 220 // making the next CompositorFrame. | |
| 221 if (!surface_returned_resources_.empty()) { | |
| 222 client_->ReclaimResources(surface_returned_resources_); | |
| 223 surface_returned_resources_.clear(); | |
| 224 } | |
| 225 client_->DidReceiveCompositorFrameAck(); | |
| 226 } | 219 } |
| 227 | 220 |
| 228 void CompositorFrameSinkSupport::ForceReclaimResources() { | 221 void CompositorFrameSinkSupport::ForceReclaimResources() { |
| 229 surface_factory_.ClearSurface(); | 222 surface_factory_.ClearSurface(); |
| 230 } | 223 } |
| 231 | 224 |
| 232 void CompositorFrameSinkSupport::ClaimTemporaryReference( | 225 void CompositorFrameSinkSupport::ClaimTemporaryReference( |
| 233 const SurfaceId& surface_id) { | 226 const SurfaceId& surface_id) { |
| 234 surface_manager_->AssignTemporaryReference(surface_id, frame_sink_id_); | 227 surface_manager_->AssignTemporaryReference(surface_id, frame_sink_id_); |
| 235 } | 228 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 261 else | 254 else |
| 262 begin_frame_source_->RemoveObserver(this); | 255 begin_frame_source_->RemoveObserver(this); |
| 263 } | 256 } |
| 264 | 257 |
| 265 void CompositorFrameSinkSupport::RequestCopyOfSurface( | 258 void CompositorFrameSinkSupport::RequestCopyOfSurface( |
| 266 std::unique_ptr<CopyOutputRequest> request) { | 259 std::unique_ptr<CopyOutputRequest> request) { |
| 267 surface_factory_.RequestCopyOfSurface(std::move(request)); | 260 surface_factory_.RequestCopyOfSurface(std::move(request)); |
| 268 } | 261 } |
| 269 | 262 |
| 270 } // namespace cc | 263 } // namespace cc |
| OLD | NEW |