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

Unified Diff: cc/surfaces/surface_dependency_tracker.cc

Issue 2814633006: Surface synchronization: Immediately activate late arriving CompositorFrames (Closed)
Patch Set: Created 3 years, 8 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/surface_dependency_tracker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_dependency_tracker.cc
diff --git a/cc/surfaces/surface_dependency_tracker.cc b/cc/surfaces/surface_dependency_tracker.cc
index dbeafe4b6bd03a76d379ebe1ed603a8dfc7ed282..89eaf14fe0e6089d50536d5dcbf2a23ea01cb88b 100644
--- a/cc/surfaces/surface_dependency_tracker.cc
+++ b/cc/surfaces/surface_dependency_tracker.cc
@@ -38,8 +38,14 @@ void SurfaceDependencyTracker::RequestSurfaceResolution(Surface* surface) {
DCHECK(surface->HasPendingFrame());
const CompositorFrame& pending_frame = surface->GetPendingFrame();
- bool needs_begin_frame =
- pending_frame.metadata.can_activate_before_dependencies;
+ bool needs_deadline = pending_frame.metadata.can_activate_before_dependencies;
+
+ auto late_it = late_surfaces_by_id_.find(surface->surface_id());
+ if (needs_deadline && late_it != late_surfaces_by_id_.end()) {
+ late_surfaces_by_id_.erase(late_it);
+ surface->ActivatePendingFrameForDeadline();
+ return;
+ }
// Referenced surface IDs that aren't currently known to the surface manager
// or do not have an active CompsotiorFrame block this frame.
@@ -55,7 +61,7 @@ void SurfaceDependencyTracker::RequestSurfaceResolution(Surface* surface) {
observed_surfaces_by_id_.insert(surface->surface_id());
}
- if (needs_begin_frame && !frames_since_deadline_set_)
+ if (needs_deadline && !frames_since_deadline_set_)
frames_since_deadline_set_ = 0;
}
@@ -73,6 +79,8 @@ void SurfaceDependencyTracker::OnBeginFrame(const BeginFrameArgs& args) {
if (++(*frames_since_deadline_set_) != kMaxBeginFrameCount)
return;
+ late_surfaces_by_id_.clear();
+
// Activate all surfaces that respect the deadline.
// Copy the set of blocked surfaces here because that set can mutate as we
// activate CompositorFrames: an activation can trigger further activations
@@ -89,8 +97,12 @@ void SurfaceDependencyTracker::OnBeginFrame(const BeginFrameArgs& args) {
}
// Clear all tracked blockers for |blocked_surface|.
for (const SurfaceId& blocking_surface_id :
- blocked_surface->blocking_surfaces())
+ blocked_surface->blocking_surfaces()) {
+ // If we are not activating this blocker now, then it's late.
+ if (!blocked_surfaces_by_id.count(blocking_surface_id))
+ late_surfaces_by_id_.insert(blocking_surface_id);
blocked_surfaces_from_dependency_[blocking_surface_id].erase(surface_id);
+ }
blocked_surface->ActivatePendingFrameForDeadline();
}
« no previous file with comments | « cc/surfaces/surface_dependency_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698