| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SERVICES_UI_WS_FRAME_GENERATOR_H_ | 5 #ifndef SERVICES_UI_WS_FRAME_GENERATOR_H_ |
| 6 #define SERVICES_UI_WS_FRAME_GENERATOR_H_ | 6 #define SERVICES_UI_WS_FRAME_GENERATOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class DisplayCompositorFrameSink; | 35 class DisplayCompositorFrameSink; |
| 36 | 36 |
| 37 namespace ws { | 37 namespace ws { |
| 38 | 38 |
| 39 namespace test { | 39 namespace test { |
| 40 class FrameGeneratorTest; | 40 class FrameGeneratorTest; |
| 41 } | 41 } |
| 42 | 42 |
| 43 class FrameGeneratorDelegate; | 43 class FrameGeneratorDelegate; |
| 44 class ServerWindow; | 44 class ServerWindow; |
| 45 class ServerWindowSurface; | 45 class ServerWindowCompositorFrameSink; |
| 46 | 46 |
| 47 // Responsible for redrawing the display in response to the redraw requests by | 47 // Responsible for redrawing the display in response to the redraw requests by |
| 48 // submitting CompositorFrames to the owned CompositorFrameSink. | 48 // submitting CompositorFrames to the owned CompositorFrameSink. |
| 49 class FrameGenerator : public ServerWindowObserver { | 49 class FrameGenerator : public ServerWindowObserver { |
| 50 public: | 50 public: |
| 51 FrameGenerator(FrameGeneratorDelegate* delegate, | 51 FrameGenerator(FrameGeneratorDelegate* delegate, |
| 52 scoped_refptr<DisplayCompositor> display_compositor); | 52 scoped_refptr<DisplayCompositor> display_compositor); |
| 53 ~FrameGenerator() override; | 53 ~FrameGenerator() override; |
| 54 | 54 |
| 55 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); | 55 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 79 | 79 |
| 80 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad | 80 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad |
| 81 // for each that lacks one. | 81 // for each that lacks one. |
| 82 void DrawWindowTree(cc::RenderPass* pass, | 82 void DrawWindowTree(cc::RenderPass* pass, |
| 83 ServerWindow* window, | 83 ServerWindow* window, |
| 84 const gfx::Vector2d& parent_to_root_origin_offset, | 84 const gfx::Vector2d& parent_to_root_origin_offset, |
| 85 float opacity, | 85 float opacity, |
| 86 bool* may_contain_video); | 86 bool* may_contain_video); |
| 87 | 87 |
| 88 // Adds a reference to the current cc::Surface of the provided | 88 // Adds a reference to the current cc::Surface of the provided |
| 89 // |window_surface|. If an existing reference is held with a different | 89 // |window_compositor_frame_sink|. If an existing reference is held with a |
| 90 // LocalFrameId then release that reference first. This is called on each | 90 // different LocalFrameId then release that reference first. This is called on |
| 91 // ServerWindowSurface as FrameGenerator walks the window tree to generate a | 91 // each ServerWindowCompositorFrameSink as FrameGenerator walks the window |
| 92 /// CompositorFrame. This is done to make sure that the window surfaces are | 92 // tree to generate a CompositorFrame. This is done to make sure that the |
| 93 // retained for the entirety of the time between submission of the top-level | 93 // window surfaces are retained for the entirety of the time between |
| 94 // frame to drawing the frame to screen. | 94 // submission of the top-level frame to drawing the frame to screen. |
| 95 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime | 95 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime |
| 96 // management. | 96 // management. |
| 97 void AddOrUpdateSurfaceReference(ServerWindowSurface* window_surface); | 97 void AddOrUpdateSurfaceReference( |
| 98 ServerWindowCompositorFrameSink* window_compositor_frame_sink); |
| 98 | 99 |
| 99 // Releases any retained references for the provided FrameSink. | 100 // Releases any retained references for the provided FrameSink. |
| 100 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime | 101 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime |
| 101 // management. | 102 // management. |
| 102 void ReleaseFrameSinkReference(const cc::FrameSinkId& frame_sink_id); | 103 void ReleaseFrameSinkReference(const cc::FrameSinkId& frame_sink_id); |
| 103 | 104 |
| 104 // Releases all retained references to surfaces. | 105 // Releases all retained references to surfaces. |
| 105 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime | 106 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime |
| 106 // management. | 107 // management. |
| 107 void ReleaseAllSurfaceReferences(); | 108 void ReleaseAllSurfaceReferences(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 134 base::WeakPtrFactory<FrameGenerator> weak_factory_; | 135 base::WeakPtrFactory<FrameGenerator> weak_factory_; |
| 135 | 136 |
| 136 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); | 137 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); |
| 137 }; | 138 }; |
| 138 | 139 |
| 139 } // namespace ws | 140 } // namespace ws |
| 140 | 141 |
| 141 } // namespace ui | 142 } // namespace ui |
| 142 | 143 |
| 143 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ | 144 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ |
| OLD | NEW |