| Index: services/ui/ws/frame_generator.h
|
| diff --git a/services/ui/ws/frame_generator.h b/services/ui/ws/frame_generator.h
|
| index ed38ee24dad99e4e8491a23c48728f1c50f0f0f3..7c95252cb555db2a7169e3cbb9e69fbe51597944 100644
|
| --- a/services/ui/ws/frame_generator.h
|
| +++ b/services/ui/ws/frame_generator.h
|
| @@ -11,9 +11,7 @@
|
| #include "base/macros.h"
|
| #include "base/timer/timer.h"
|
| #include "cc/surfaces/frame_sink_id.h"
|
| -#include "cc/surfaces/local_frame_id.h"
|
| -#include "cc/surfaces/surface_sequence.h"
|
| -#include "cc/surfaces/surface_sequence_generator.h"
|
| +#include "cc/surfaces/surface_id.h"
|
| #include "services/ui/public/interfaces/window_tree_constants.mojom.h"
|
| #include "services/ui/ws/ids.h"
|
| #include "services/ui/ws/server_window_tracker.h"
|
| @@ -56,6 +54,22 @@ class FrameGenerator : public ServerWindowTracker,
|
| // Schedules a redraw for the provided region.
|
| void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget);
|
|
|
| + // Adds a reference to new surface with |surface_id| for |window|. This
|
| + // reference is to ensure the surface is not deleted while it's still being
|
| + // displayed. The display root surface has a reference from the top level
|
| + // root. All child surfaces are embedded by the display root and receive a
|
| + // reference from it.
|
| + //
|
| + // If the display root Surface is updated, then all child surfaces will
|
| + // receive a reference from the new display root so they are not deleted with
|
| + // the old display root.
|
| + //
|
| + // If there is an existing reference to an old surface with the same
|
| + // FrameSinkId then that reference will be removed after the next
|
| + // CompositorFrame is submitted.
|
| + void AddSurfaceReference(const cc::SurfaceId& surface_id,
|
| + ServerWindow* window);
|
| +
|
| private:
|
| friend class ui::ws::test::FrameGeneratorTest;
|
|
|
| @@ -74,27 +88,20 @@ class FrameGenerator : public ServerWindowTracker,
|
| const gfx::Vector2d& parent_to_root_origin_offset,
|
| float opacity);
|
|
|
| - // Adds a reference to the current cc::Surface of the provided
|
| - // |window_compositor_frame_sink|. If an existing reference is held with a
|
| - // different LocalFrameId then release that reference first. This is called on
|
| - // each ServerWindowCompositorFrameSink as FrameGenerator walks the window
|
| - // tree to generate a CompositorFrame. This is done to make sure that the
|
| - // window surfaces are retained for the entirety of the time between
|
| - // submission of the top-level frame to drawing the frame to screen.
|
| - // TODO(fsamuel, kylechar): This will go away once we get surface lifetime
|
| - // management.
|
| - void AddOrUpdateSurfaceReference(mojom::CompositorFrameSinkType type,
|
| - ServerWindow* window);
|
| -
|
| - // Releases any retained references for the provided FrameSink.
|
| - // TODO(fsamuel, kylechar): This will go away once we get surface lifetime
|
| - // management.
|
| - void ReleaseFrameSinkReference(const cc::FrameSinkId& frame_sink_id);
|
| -
|
| - // Releases all retained references to surfaces.
|
| - // TODO(fsamuel, kylechar): This will go away once we get surface lifetime
|
| - // management.
|
| - void ReleaseAllSurfaceReferences();
|
| + // Finds all Surfaces with references from |old_surface_id| and adds a new
|
| + // reference from |new_surface_id|. The caller should remove any references
|
| + // to |old_surface_id| afterwards to finish cleanup.
|
| + void AddNewParentReferences(const cc::SurfaceId& old_surface_id,
|
| + const cc::SurfaceId& new_surface_id);
|
| +
|
| + // Removes all references to surfaces in |dead_references_|.
|
| + void RemoveDeadSurfaceReferences();
|
| +
|
| + // Removes any retained references for the provided FrameSink.
|
| + void RemoveFrameSinkReference(const cc::FrameSinkId& frame_sink_id);
|
| +
|
| + // Removes all retained references to surfaces.
|
| + void RemoveAllSurfaceReferences();
|
|
|
| ui::DisplayCompositor* GetDisplayCompositor();
|
|
|
| @@ -102,20 +109,25 @@ class FrameGenerator : public ServerWindowTracker,
|
| void OnWindowDestroying(ServerWindow* window) override;
|
|
|
| FrameGeneratorDelegate* delegate_;
|
| - cc::FrameSinkId frame_sink_id_;
|
| ServerWindow* const root_window_;
|
| - cc::SurfaceSequenceGenerator surface_sequence_generator_;
|
| scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
|
|
|
| cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_;
|
| gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget;
|
|
|
| - struct SurfaceDependency {
|
| - cc::LocalFrameId local_frame_id;
|
| - cc::SurfaceSequence sequence;
|
| + struct SurfaceReference {
|
| + cc::SurfaceId parent_id;
|
| + cc::SurfaceId child_id;
|
| };
|
| - std::unordered_map<cc::FrameSinkId, SurfaceDependency, cc::FrameSinkIdHash>
|
| - dependencies_;
|
| +
|
| + // Active references held by this client to Surfaces that could be used in a
|
| + // CompositorFrame.
|
| + std::unordered_map<cc::FrameSinkId, SurfaceReference, cc::FrameSinkIdHash>
|
| + active_references_;
|
| +
|
| + // References to surfaces that should be removed after a CompositorFrame has
|
| + // been submitted and the surfaces are no longer being referenced.
|
| + std::vector<SurfaceReference> dead_references_;
|
|
|
| mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_;
|
|
|
|
|