| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "ui/gfx/native_widget_types.h" | 21 #include "ui/gfx/native_widget_types.h" |
| 22 | 22 |
| 23 namespace cc { | 23 namespace cc { |
| 24 class CompositorFrameSink; | 24 class CompositorFrameSink; |
| 25 class RenderPass; | 25 class RenderPass; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace ui { | 28 namespace ui { |
| 29 namespace ws { | 29 namespace ws { |
| 30 | 30 |
| 31 class FrameGeneratorDelegate; | |
| 32 class ServerWindow; | 31 class ServerWindow; |
| 33 | 32 |
| 34 // Responsible for redrawing the display in response to the redraw requests by | 33 // Responsible for redrawing the display in response to the redraw requests by |
| 35 // submitting CompositorFrames to the owned CompositorFrameSink. | 34 // submitting CompositorFrames to the owned CompositorFrameSink. |
| 36 class FrameGenerator : public cc::CompositorFrameSinkClient, | 35 class FrameGenerator : public cc::CompositorFrameSinkClient, |
| 37 public cc::BeginFrameObserver { | 36 public cc::BeginFrameObserver { |
| 38 public: | 37 public: |
| 39 FrameGenerator( | 38 FrameGenerator( |
| 40 FrameGeneratorDelegate* delegate, | |
| 41 ServerWindow* root_window, | 39 ServerWindow* root_window, |
| 42 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink); | 40 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink); |
| 43 ~FrameGenerator() override; | 41 ~FrameGenerator() override; |
| 44 | 42 |
| 45 void SetDeviceScaleFactor(float device_scale_factor); | 43 void SetDeviceScaleFactor(float device_scale_factor); |
| 44 void SetHighContrastMode(bool enabled); |
| 46 | 45 |
| 47 // Updates the WindowManager's SurfaceInfo. | 46 // Updates the WindowManager's SurfaceInfo. |
| 48 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info); | 47 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info); |
| 49 | 48 |
| 50 void OnWindowDamaged(); | 49 void OnWindowDamaged(); |
| 51 | 50 |
| 52 private: | 51 private: |
| 53 // cc::CompositorFrameSinkClient implementation: | 52 // cc::CompositorFrameSinkClient implementation: |
| 54 void SetBeginFrameSource(cc::BeginFrameSource* source) override; | 53 void SetBeginFrameSource(cc::BeginFrameSource* source) override; |
| 55 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | 54 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 73 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect); | 72 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect); |
| 74 | 73 |
| 75 // DrawWindow creates SurfaceDrawQuad for the window manager and appends it to | 74 // DrawWindow creates SurfaceDrawQuad for the window manager and appends it to |
| 76 // the provided cc::RenderPass. | 75 // the provided cc::RenderPass. |
| 77 void DrawWindow(cc::RenderPass* pass); | 76 void DrawWindow(cc::RenderPass* pass); |
| 78 | 77 |
| 79 // SetNeedsBeginFrame sets observing_begin_frames_ and add/remove | 78 // SetNeedsBeginFrame sets observing_begin_frames_ and add/remove |
| 80 // FrameGenerator as an observer to/from begin_frame_source_ accordingly. | 79 // FrameGenerator as an observer to/from begin_frame_source_ accordingly. |
| 81 void SetNeedsBeginFrame(bool needs_begin_frame); | 80 void SetNeedsBeginFrame(bool needs_begin_frame); |
| 82 | 81 |
| 83 FrameGeneratorDelegate* delegate_; | |
| 84 ServerWindow* const root_window_; | 82 ServerWindow* const root_window_; |
| 85 float device_scale_factor_ = 1.f; | 83 float device_scale_factor_ = 1.f; |
| 86 | 84 |
| 87 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink_; | 85 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink_; |
| 88 cc::BeginFrameArgs last_begin_frame_args_; | 86 cc::BeginFrameArgs last_begin_frame_args_; |
| 89 cc::BeginFrameSource* begin_frame_source_ = nullptr; | 87 cc::BeginFrameSource* begin_frame_source_ = nullptr; |
| 90 bool observing_begin_frames_ = false; | 88 bool observing_begin_frames_ = false; |
| 89 bool high_contrast_mode_enabled_ = false; |
| 91 | 90 |
| 92 cc::SurfaceInfo window_manager_surface_info_; | 91 cc::SurfaceInfo window_manager_surface_info_; |
| 93 | 92 |
| 94 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); | 93 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); |
| 95 }; | 94 }; |
| 96 | 95 |
| 97 } // namespace ws | 96 } // namespace ws |
| 98 | 97 |
| 99 } // namespace ui | 98 } // namespace ui |
| 100 | 99 |
| 101 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ | 100 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ |
| OLD | NEW |