Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: services/ui/ws/frame_generator.h

Issue 2763143002: Remove FrameGenerator::root_window_ (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | services/ui/ws/frame_generator.cc » ('j') | services/ui/ws/frame_generator.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 ServerWindow;
32
33 // Responsible for redrawing the display in response to the redraw requests by 31 // Responsible for redrawing the display in response to the redraw requests by
34 // submitting CompositorFrames to the owned CompositorFrameSink. 32 // submitting CompositorFrames to the owned CompositorFrameSink.
35 class FrameGenerator : public cc::CompositorFrameSinkClient, 33 class FrameGenerator : public cc::CompositorFrameSinkClient,
36 public cc::BeginFrameObserver { 34 public cc::BeginFrameObserver {
37 public: 35 public:
38 FrameGenerator( 36 FrameGenerator(std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink,
39 ServerWindow* root_window, 37 bool visible,
Fady Samuel 2017/03/22 03:38:39 Hmm, we don't do this for device_scale_factor... M
Alex Z. 2017/03/22 13:17:17 I did it this way to preserve the same behavior. C
Alex Z. 2017/03/22 14:56:44 Done.
40 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink); 38 const gfx::Rect& bounds);
41 ~FrameGenerator() override; 39 ~FrameGenerator() override;
42 40
43 void SetDeviceScaleFactor(float device_scale_factor); 41 void SetDeviceScaleFactor(float device_scale_factor);
44 void SetHighContrastMode(bool enabled); 42 void SetHighContrastMode(bool enabled);
45 43
46 // Updates the WindowManager's SurfaceInfo. 44 // Updates the WindowManager's SurfaceInfo.
47 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info); 45 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info);
48 46
49 void OnWindowDamaged(); 47 void OnWindowDamaged();
48 void OnWindowVisibilityChanged(bool visible);
49 void OnWindowBoundsChanged(const gfx::Rect& bounds);
50 50
51 private: 51 private:
52 // cc::CompositorFrameSinkClient implementation: 52 // cc::CompositorFrameSinkClient implementation:
53 void SetBeginFrameSource(cc::BeginFrameSource* source) override; 53 void SetBeginFrameSource(cc::BeginFrameSource* source) override;
54 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 54 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
55 void SetTreeActivationCallback(const base::Closure& callback) override; 55 void SetTreeActivationCallback(const base::Closure& callback) override;
56 void DidReceiveCompositorFrameAck() override; 56 void DidReceiveCompositorFrameAck() override;
57 void DidLoseCompositorFrameSink() override; 57 void DidLoseCompositorFrameSink() override;
58 void OnDraw(const gfx::Transform& transform, 58 void OnDraw(const gfx::Transform& transform,
59 const gfx::Rect& viewport, 59 const gfx::Rect& viewport,
60 bool resourceless_software_draw) override; 60 bool resourceless_software_draw) override;
61 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; 61 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override;
62 void SetExternalTilePriorityConstraints( 62 void SetExternalTilePriorityConstraints(
63 const gfx::Rect& viewport_rect, 63 const gfx::Rect& viewport_rect,
64 const gfx::Transform& transform) override; 64 const gfx::Transform& transform) override;
65 65
66 // cc::BeginFrameObserver implementation: 66 // cc::BeginFrameObserver implementation:
67 void OnBeginFrame(const cc::BeginFrameArgs& args) override; 67 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
68 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; 68 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
69 void OnBeginFrameSourcePausedChanged(bool paused) override; 69 void OnBeginFrameSourcePausedChanged(bool paused) override;
70 70
71 // Generates the CompositorFrame. 71 // Generates the CompositorFrame.
72 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect); 72 cc::CompositorFrame GenerateCompositorFrame();
73 73
74 // DrawWindow creates SurfaceDrawQuad for the window manager and appends it to 74 // DrawWindow creates SurfaceDrawQuad for the window manager and appends it to
75 // the provided cc::RenderPass. 75 // the provided cc::RenderPass.
76 void DrawWindow(cc::RenderPass* pass); 76 void DrawWindow(cc::RenderPass* pass);
77 77
78 // SetNeedsBeginFrame sets observing_begin_frames_ and add/remove 78 // SetNeedsBeginFrame sets observing_begin_frames_ and add/remove
79 // FrameGenerator as an observer to/from begin_frame_source_ accordingly. 79 // FrameGenerator as an observer to/from begin_frame_source_ accordingly.
80 void SetNeedsBeginFrame(bool needs_begin_frame); 80 void SetNeedsBeginFrame(bool needs_begin_frame);
81 81
82 ServerWindow* const root_window_;
83 float device_scale_factor_ = 1.f; 82 float device_scale_factor_ = 1.f;
83 bool is_window_visible_;
84 gfx::Rect bounds_;
84 85
85 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink_; 86 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink_;
86 cc::BeginFrameArgs last_begin_frame_args_; 87 cc::BeginFrameArgs last_begin_frame_args_;
87 cc::BeginFrameSource* begin_frame_source_ = nullptr; 88 cc::BeginFrameSource* begin_frame_source_ = nullptr;
88 bool observing_begin_frames_ = false; 89 bool observing_begin_frames_ = false;
89 bool high_contrast_mode_enabled_ = false; 90 bool high_contrast_mode_enabled_ = false;
90 91
91 cc::SurfaceInfo window_manager_surface_info_; 92 cc::SurfaceInfo window_manager_surface_info_;
92 93
93 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 94 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
94 }; 95 };
95 96
96 } // namespace ws 97 } // namespace ws
97 98
98 } // namespace ui 99 } // namespace ui
99 100
100 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 101 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/ws/frame_generator.cc » ('j') | services/ui/ws/frame_generator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698