viz: Mark and delete old temporary references

Desktop / Chromium - kylechar [] - 10 August 2017 01:21 EDT

There is some potential for temporary references to get "orphaned" and never deleted. There is a potential race, where a new surface activates and the expected embedder is assigned a temporary reference to it. Normally, the embedder would submit a CompositorFrame that references the new surface and the temporary reference would get deleted. If the embedder were to instead immediately unembed the frame sink of the new surface, before submitting a CompositorFrame, the temporary reference wouldn't get replaced.

This CL adds a check every 10s in SurfaceManager to look for old temporary references. If a temporary reference has existed for 2 checks then it is older than 10s and is likely orphaned. We delete the old temporary reference, which will cause the surface to get garbage collected if it has been marked as destroyed.

This race is so far purely theoretical and I have not been able to produce it. So more importantly, this CL adds an UMA stat with the number of old temporary references. This will allow us to see (1) if the 10s check is necessary at all and (2) if we need to add a more complicated mechanism to track orphaned temporary references.

Bug: 676384 Change-Id: I88d95e46f1a52839d5d21eb8e5d54e2895aae08c Reviewed-on: Commit-Queue: kylechar

90ac48a viz: Mark and delete old temporary references.
.../viz/service/display/ | 2 +
components/viz/service/surfaces/ | 78 ++++++++++++++++++----
components/viz/service/surfaces/surface_manager.h | 26 ++++++--
tools/metrics/histograms/histograms.xml | 8 +++
4 files changed, 96 insertions(+), 18 deletions(-)


  • Share