In LayerTreeHost there is a flat_set<SurfaceId> for all SurfaceIds that a SurfaceLayer exists for. This flat_set is used to build the list of referenced surfaces for the resulting CompositorFrame.
This set doesn't work correctly when there are multiple SurfaceLayers with the same SurfaceId. This happens with CrOS window minimize/maximize animations.
For example, at the start of say maximize the SurfaceLayer for |old_surface_id| is cloned. There are two SurfaceLayers with the same SurfaceId at this point. The resized window has a new SurfaceId |new_surface_id|. One of the SurrfaceLayers is modified to use |new_surface_id|, which calls LayerTreeHost::RemoveSurfaceLayerId(old_surface_id) and then LayerTreeHost::AddSurfaceLayerId(new_surface_id). This removes |old_surface_id| from the set referenced surfaces, even though a SurfaceLayer still exists for it and SurfaceDrawQuad is produced for it.
I'll update LayerTreeHost to keep track of the number of surface layers for a SurfaceId (eg flat_set<SurfaceId> becomes flat_map<SurfaceId, int)>).
Comment 1 by bugdroid1@chromium.org
, Jun 12 2017