Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(897)

Unified Diff: cc/surfaces/compositor_frame_sink_support.cc

Issue 2688043002: Retain references to surfaces from both active AND pending CompositorFrames (Closed)
Patch Set: Added TODOs and addressed comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.h ('k') | cc/surfaces/compositor_frame_sink_support_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/compositor_frame_sink_support.cc
diff --git a/cc/surfaces/compositor_frame_sink_support.cc b/cc/surfaces/compositor_frame_sink_support.cc
index e7848f8021f16e3d3cadc78723a0076d505d2e9f..f79f22cb54f6342330d69186cab853c42545429b 100644
--- a/cc/surfaces/compositor_frame_sink_support.cc
+++ b/cc/surfaces/compositor_frame_sink_support.cc
@@ -76,25 +76,34 @@ void CompositorFrameSinkSupport::SubmitCompositorFrame(
++ack_pending_count_;
float device_scale_factor = frame.metadata.device_scale_factor;
+ surface_factory_.SubmitCompositorFrame(
+ local_surface_id, std::move(frame),
+ base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck,
+ weak_factory_.GetWeakPtr()));
+
if (surface_manager_->using_surface_references()) {
SurfaceId last_surface_id = reference_tracker_.current_surface_id();
// Populate list of surface references to add and remove based on reference
- // surfaces in current frame compared with the last frame.
- reference_tracker_.UpdateReferences(local_surface_id,
- frame.metadata.referenced_surfaces);
-
- surface_factory_.SubmitCompositorFrame(
- local_surface_id, std::move(frame),
- base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck,
- weak_factory_.GetWeakPtr()));
+ // surfaces in current frame compared with the last frame. The list of
+ // surface references includes references from both the pending and active
+ // frame if any.
+ SurfaceId current_surface_id(frame_sink_id_, local_surface_id);
+ Surface* surface = surface_manager_->GetSurfaceForId(current_surface_id);
+ // TODO(fsamuel): This is pretty inefficent. We copy over referenced
+ // surfaces. Then we pass them into the ReferencedSurfaceTracker to copy
+ // them again into a set. ReferencedSurfaceTracker should just take in two
+ // vectors, one for pending referenced surfaces and one for active
+ // referenced surfaces.
+ std::vector<SurfaceId> referenced_surfaces =
+ surface->active_referenced_surfaces();
+
+ referenced_surfaces.insert(referenced_surfaces.end(),
+ surface->pending_referenced_surfaces().begin(),
+ surface->pending_referenced_surfaces().end());
+ reference_tracker_.UpdateReferences(local_surface_id, referenced_surfaces);
UpdateSurfaceReferences(last_surface_id, local_surface_id);
- } else {
- surface_factory_.SubmitCompositorFrame(
- local_surface_id, std::move(frame),
- base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck,
- weak_factory_.GetWeakPtr()));
}
if (display_)
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.h ('k') | cc/surfaces/compositor_frame_sink_support_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698