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 27 matching lines...) Expand all Loading... |
38 class DisplayCompositor; | 38 class DisplayCompositor; |
39 | 39 |
40 namespace ws { | 40 namespace ws { |
41 | 41 |
42 namespace test { | 42 namespace test { |
43 class FrameGeneratorTest; | 43 class FrameGeneratorTest; |
44 } | 44 } |
45 | 45 |
46 class FrameGeneratorDelegate; | 46 class FrameGeneratorDelegate; |
47 class ServerWindow; | 47 class ServerWindow; |
48 class ServerWindowSurface; | 48 class ServerWindowCompositorFrameSink; |
49 | 49 |
50 // Responsible for redrawing the display in response to the redraw requests by | 50 // Responsible for redrawing the display in response to the redraw requests by |
51 // submitting CompositorFrames to the owned CompositorFrameSink. | 51 // submitting CompositorFrames to the owned CompositorFrameSink. |
52 class FrameGenerator : public ServerWindowObserver { | 52 class FrameGenerator : public ServerWindowObserver { |
53 public: | 53 public: |
54 FrameGenerator(FrameGeneratorDelegate* delegate, | 54 FrameGenerator(FrameGeneratorDelegate* delegate, |
55 scoped_refptr<DisplayCompositor> display_compositor); | 55 scoped_refptr<DisplayCompositor> display_compositor); |
56 ~FrameGenerator() override; | 56 ~FrameGenerator() override; |
57 | 57 |
58 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); | 58 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); |
(...skipping 25 matching lines...) Expand all Loading... |
84 | 84 |
85 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad | 85 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad |
86 // for each that lacks one. | 86 // for each that lacks one. |
87 void DrawWindowTree(cc::RenderPass* pass, | 87 void DrawWindowTree(cc::RenderPass* pass, |
88 ServerWindow* window, | 88 ServerWindow* window, |
89 const gfx::Vector2d& parent_to_root_origin_offset, | 89 const gfx::Vector2d& parent_to_root_origin_offset, |
90 float opacity, | 90 float opacity, |
91 bool* may_contain_video); | 91 bool* may_contain_video); |
92 | 92 |
93 // Adds a reference to the current cc::Surface of the provided | 93 // Adds a reference to the current cc::Surface of the provided |
94 // |window_surface|. If an existing reference is held with a different | 94 // |window_compositor_frame_sink|. If an existing reference is held with a |
95 // LocalFrameId then release that reference first. This is called on each | 95 // different LocalFrameId then release that reference first. This is called on |
96 // ServerWindowSurface as FrameGenerator walks the window tree to generate a | 96 // each ServerWindowCompositorFrameSink as FrameGenerator walks the window |
97 /// CompositorFrame. This is done to make sure that the window surfaces are | 97 // tree to generate a CompositorFrame. This is done to make sure that the |
98 // retained for the entirety of the time between submission of the top-level | 98 // window surfaces are retained for the entirety of the time between |
99 // frame to drawing the frame to screen. | 99 // submission of the top-level frame to drawing the frame to screen. |
100 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime | 100 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime |
101 // management. | 101 // management. |
102 void AddOrUpdateSurfaceReference(ServerWindowSurface* window_surface); | 102 void AddOrUpdateSurfaceReference( |
| 103 ServerWindowCompositorFrameSink* window_compositor_frame_sink); |
103 | 104 |
104 // Releases any retained references for the provided FrameSink. | 105 // Releases any retained references for the provided FrameSink. |
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 ReleaseFrameSinkReference(const cc::FrameSinkId& frame_sink_id); | 108 void ReleaseFrameSinkReference(const cc::FrameSinkId& frame_sink_id); |
108 | 109 |
109 // Releases all retained references to surfaces. | 110 // Releases all retained references to surfaces. |
110 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime | 111 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime |
111 // management. | 112 // management. |
112 void ReleaseAllSurfaceReferences(); | 113 void ReleaseAllSurfaceReferences(); |
(...skipping 26 matching lines...) Expand all Loading... |
139 base::WeakPtrFactory<FrameGenerator> weak_factory_; | 140 base::WeakPtrFactory<FrameGenerator> weak_factory_; |
140 | 141 |
141 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); | 142 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); |
142 }; | 143 }; |
143 | 144 |
144 } // namespace ws | 145 } // namespace ws |
145 | 146 |
146 } // namespace ui | 147 } // namespace ui |
147 | 148 |
148 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ | 149 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ |
OLD | NEW |