| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 class FrameGeneratorDelegate; | 45 class FrameGeneratorDelegate; |
| 46 class ServerWindow; | 46 class ServerWindow; |
| 47 class ServerWindowCompositorFrameSink; | 47 class ServerWindowCompositorFrameSink; |
| 48 | 48 |
| 49 // Responsible for redrawing the display in response to the redraw requests by | 49 // Responsible for redrawing the display in response to the redraw requests by |
| 50 // submitting CompositorFrames to the owned CompositorFrameSink. | 50 // submitting CompositorFrames to the owned CompositorFrameSink. |
| 51 class FrameGenerator : public ServerWindowTracker, | 51 class FrameGenerator : public ServerWindowTracker, |
| 52 public cc::mojom::MojoCompositorFrameSinkClient { | 52 public cc::mojom::MojoCompositorFrameSinkClient { |
| 53 public: | 53 public: |
| 54 FrameGenerator(FrameGeneratorDelegate* delegate, | 54 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window); |
| 55 ServerWindow* root_window, | |
| 56 scoped_refptr<DisplayCompositor> display_compositor); | |
| 57 ~FrameGenerator() override; | 55 ~FrameGenerator() override; |
| 58 | 56 |
| 59 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); | 57 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); |
| 60 | 58 |
| 61 // Schedules a redraw for the provided region. | 59 // Schedules a redraw for the provided region. |
| 62 void RequestRedraw(const gfx::Rect& redraw_region); | 60 void RequestRedraw(const gfx::Rect& redraw_region); |
| 63 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); | 61 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); |
| 64 | 62 |
| 65 bool is_frame_pending() { return frame_pending_; } | 63 bool is_frame_pending() { return frame_pending_; } |
| 66 | 64 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // Releases any retained references for the provided FrameSink. | 101 // Releases any retained references for the provided FrameSink. |
| 104 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime | 102 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime |
| 105 // management. | 103 // management. |
| 106 void ReleaseFrameSinkReference(const cc::FrameSinkId& frame_sink_id); | 104 void ReleaseFrameSinkReference(const cc::FrameSinkId& frame_sink_id); |
| 107 | 105 |
| 108 // Releases all retained references to surfaces. | 106 // Releases all retained references to surfaces. |
| 109 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime | 107 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime |
| 110 // management. | 108 // management. |
| 111 void ReleaseAllSurfaceReferences(); | 109 void ReleaseAllSurfaceReferences(); |
| 112 | 110 |
| 111 ui::DisplayCompositor* GetDisplayCompositor(); |
| 112 |
| 113 // ServerWindowObserver implementation. | 113 // ServerWindowObserver implementation. |
| 114 void OnWindowDestroying(ServerWindow* window) override; | 114 void OnWindowDestroying(ServerWindow* window) override; |
| 115 | 115 |
| 116 FrameGeneratorDelegate* delegate_; | 116 FrameGeneratorDelegate* delegate_; |
| 117 scoped_refptr<DisplayCompositor> display_compositor_; | |
| 118 cc::FrameSinkId frame_sink_id_; | 117 cc::FrameSinkId frame_sink_id_; |
| 119 ServerWindow* const root_window_; | 118 ServerWindow* const root_window_; |
| 120 cc::SurfaceSequenceGenerator surface_sequence_generator_; | 119 cc::SurfaceSequenceGenerator surface_sequence_generator_; |
| 121 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; | 120 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; |
| 122 | 121 |
| 123 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; | 122 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; |
| 124 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget; | 123 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget; |
| 125 | 124 |
| 126 // The region that needs to be redrawn next time the compositor frame is | 125 // The region that needs to be redrawn next time the compositor frame is |
| 127 // generated. | 126 // generated. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 140 base::WeakPtrFactory<FrameGenerator> weak_factory_; | 139 base::WeakPtrFactory<FrameGenerator> weak_factory_; |
| 141 | 140 |
| 142 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); | 141 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); |
| 143 }; | 142 }; |
| 144 | 143 |
| 145 } // namespace ws | 144 } // namespace ws |
| 146 | 145 |
| 147 } // namespace ui | 146 } // namespace ui |
| 148 | 147 |
| 149 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ | 148 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ |
| OLD | NEW |