| 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 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 class CompositorFrame; | 16 class CompositorFrame; |
| 17 class CopyOutputRequest; | 17 class CopyOutputRequest; |
| 18 class RenderPass; | 18 class RenderPass; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace ui { | 21 namespace ui { |
| 22 | 22 |
| 23 class DisplayCompositor; | 23 class DisplayCompositor; |
| 24 class GpuState; | |
| 25 class SurfacesState; | 24 class SurfacesState; |
| 26 | 25 |
| 27 namespace ws { | 26 namespace ws { |
| 28 | 27 |
| 29 namespace test { | 28 namespace test { |
| 30 class FrameGeneratorTest; | 29 class FrameGeneratorTest; |
| 31 } | 30 } |
| 32 | 31 |
| 33 class FrameGeneratorDelegate; | 32 class FrameGeneratorDelegate; |
| 34 class ServerWindow; | 33 class ServerWindow; |
| 35 | 34 |
| 36 // Responsible for redrawing the display in response to the redraw requests by | 35 // Responsible for redrawing the display in response to the redraw requests by |
| 37 // submitting CompositorFrames to the owned DisplayCompositor. | 36 // submitting CompositorFrames to the owned DisplayCompositor. |
| 38 class FrameGenerator { | 37 class FrameGenerator { |
| 39 public: | 38 public: |
| 40 FrameGenerator(FrameGeneratorDelegate* delegate, | 39 FrameGenerator(FrameGeneratorDelegate* delegate, |
| 41 scoped_refptr<GpuState> gpu_state, | |
| 42 scoped_refptr<SurfacesState> surfaces_state); | 40 scoped_refptr<SurfacesState> surfaces_state); |
| 43 virtual ~FrameGenerator(); | 41 virtual ~FrameGenerator(); |
| 44 | 42 |
| 45 // Schedules a redraw for the provided region. | 43 // Schedules a redraw for the provided region. |
| 46 void RequestRedraw(const gfx::Rect& redraw_region); | 44 void RequestRedraw(const gfx::Rect& redraw_region); |
| 47 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); | 45 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); |
| 48 void RequestCopyOfOutput( | 46 void RequestCopyOfOutput( |
| 49 std::unique_ptr<cc::CopyOutputRequest> output_request); | 47 std::unique_ptr<cc::CopyOutputRequest> output_request); |
| 50 | 48 |
| 51 bool is_frame_pending() { return frame_pending_; } | 49 bool is_frame_pending() { return frame_pending_; } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 69 cc::CompositorFrame GenerateCompositorFrame(); | 67 cc::CompositorFrame GenerateCompositorFrame(); |
| 70 | 68 |
| 71 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad | 69 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad |
| 72 // for each that lacks one. | 70 // for each that lacks one. |
| 73 void DrawWindowTree(cc::RenderPass* pass, | 71 void DrawWindowTree(cc::RenderPass* pass, |
| 74 ServerWindow* window, | 72 ServerWindow* window, |
| 75 const gfx::Vector2d& parent_to_root_origin_offset, | 73 const gfx::Vector2d& parent_to_root_origin_offset, |
| 76 float opacity); | 74 float opacity); |
| 77 | 75 |
| 78 FrameGeneratorDelegate* delegate_; | 76 FrameGeneratorDelegate* delegate_; |
| 79 scoped_refptr<GpuState> gpu_state_; | |
| 80 scoped_refptr<SurfacesState> surfaces_state_; | 77 scoped_refptr<SurfacesState> surfaces_state_; |
| 81 | 78 |
| 82 std::unique_ptr<DisplayCompositor> display_compositor_; | 79 std::unique_ptr<DisplayCompositor> display_compositor_; |
| 83 | 80 |
| 84 // The region that needs to be redrawn next time the compositor frame is | 81 // The region that needs to be redrawn next time the compositor frame is |
| 85 // generated. | 82 // generated. |
| 86 gfx::Rect dirty_rect_; | 83 gfx::Rect dirty_rect_; |
| 87 base::Timer draw_timer_; | 84 base::Timer draw_timer_; |
| 88 bool frame_pending_ = false; | 85 bool frame_pending_ = false; |
| 89 | 86 |
| 90 base::WeakPtrFactory<FrameGenerator> weak_factory_; | 87 base::WeakPtrFactory<FrameGenerator> weak_factory_; |
| 91 | 88 |
| 92 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); | 89 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); |
| 93 }; | 90 }; |
| 94 | 91 |
| 95 } // namespace ws | 92 } // namespace ws |
| 96 | 93 |
| 97 } // namespace ui | 94 } // namespace ui |
| 98 | 95 |
| 99 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ | 96 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ |
| OLD | NEW |