Commit 2441a576 authored by Fady Samuel's avatar Fady Samuel Committed by Commit Bot

Surface Synchronization: Simplify SurfaceDependencyTracker::OnSurfaceDiscarded

OnSurfaceDiscarded cosists of two operations:

1. Drop tracking of dependencies of the discarded surface.
2. Unblock surfaces blocked ont he discarded surface.

1. is equivalent to listing all activation dependencies as
'removed_dependencies' and calling OnSurfaceDependenciesChanged.

This CL does just that, reducing the number of lines of code in
SurfaceDependencyTracker further.

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel
Change-Id: I8191f1be81d04cce0c2181ac4fc341ebb8e3cf3f
Bug: 672962
Reviewed-on: https://chromium-review.googlesource.com/1163632
Commit-Queue: Fady Samuel <fsamuel@chromium.org>
Reviewed-by: default avatarvmpstr <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581016}
parent 30de025e
......@@ -58,40 +58,28 @@ void SurfaceDependencyTracker::OnSurfaceDependenciesChanged(
for (const FrameSinkId& frame_sink_id : removed_dependencies) {
auto it = blocked_surfaces_from_dependency_.find(frame_sink_id);
it->second.erase(surface->surface_id());
if (it->second.empty())
blocked_surfaces_from_dependency_.erase(it);
if (it != blocked_surfaces_from_dependency_.end()) {
it->second.erase(surface->surface_id());
if (it->second.empty())
blocked_surfaces_from_dependency_.erase(it);
}
}
}
void SurfaceDependencyTracker::OnSurfaceDiscarded(Surface* surface) {
surfaces_with_missing_dependencies_.erase(surface->surface_id());
// If the surface being destroyed doesn't have a pending frame then we have
// nothing to do here.
if (!surface->HasPendingFrame())
return;
for (const SurfaceId& surface_id : surface->activation_dependencies()) {
auto it =
blocked_surfaces_from_dependency_.find(surface_id.frame_sink_id());
if (it == blocked_surfaces_from_dependency_.end())
continue;
base::flat_set<FrameSinkId> removed_dependencies;
for (const SurfaceId& surface_id : surface->activation_dependencies())
removed_dependencies.insert(surface_id.frame_sink_id());
auto& blocked_surface_ids = it->second;
auto blocked_surface_ids_it =
blocked_surface_ids.find(surface->surface_id());
if (blocked_surface_ids_it != blocked_surface_ids.end()) {
blocked_surface_ids.erase(surface->surface_id());
if (blocked_surface_ids.empty())
blocked_surfaces_from_dependency_.erase(surface_id.frame_sink_id());
}
}
OnSurfaceDependenciesChanged(surface, {}, removed_dependencies);
// Pretend that the discarded surface's SurfaceId is now available to
// unblock dependencies because we now know the surface will never activate.
NotifySurfaceIdAvailable(surface->surface_id());
}
void SurfaceDependencyTracker::OnFrameSinkInvalidated(
const FrameSinkId& frame_sink_id) {
// We now know the frame sink will never generated any more frames,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment