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